Language construct naming: Function/Goto

Posted by sub on Stack Overflow See other posts from Stack Overflow or by sub
Published on 2010-04-06T10:14:24Z Indexed on 2010/04/06 10:33 UTC
Read the original article Hit count: 211

Filed under:
|
|

How is a language construct with the following properties called?

  • It has a beginning and an end, just like a function
  • It has a header containing it's name, also like a function but without arguments
  • There can be any number of statements between its beginning and end, like a function

  • You can use a function to jump to its beginning from anywhere (even itself) and it will execute the statements contained in it until it reaches its end

  • You can use a function to immediately stop the execution of its contents and jump back where it was called from

  • The code it contains is in the same scope as everything else, so you can access all variables outside and create new ones which aren't deleted upon leaving the construct.

All in all it is like a goto point with an end and the option to return where it was called from.

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about function