Language mavens: Is there a programming with "if then else ENDIF" syntax?

Nobody nobody at nowhere.com
Mon Nov 16 13:17:12 EST 2009


On Mon, 16 Nov 2009 08:54:28 -0800, Steve Ferg wrote:

> For a long time I've wondered why languages still use blocks
> (delimited by do/end, begin/end, { } , etc.) in ifThenElse statements.
> 
> I've often thought that a language with this kind of block-free syntax
> would be nice and intuitive:
> 
>     if <condition> then
>         do stuff
>     elif <condition> then
>         do stuff
>     else
>         do stuff
>     endif
> 
> Note that you do not need block delimiters.

> Does anybody know a language with this kind of syntax for
> ifThenElseEndif? 

BBC BASIC V had if/then/else/endif (it didn't have elif).

"make" has if/else/else/endif (it doesn't have a dedicated elif, but
"else if ..." behaves like elif rather than starting a nested "if").

> Is there any particular reason why this might be a *bad* language-
> design idea?

Blocks can be useful for other reasons (e.g. limiting variable scope), so
if you already have them, you don't need to provide dedicated blocks
for control constructs.




More information about the Python-list mailing list