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

Chris Rebert clp2 at rebertia.com
Mon Nov 16 20:20:29 CET 2009


On Mon, Nov 16, 2009 at 8:54 AM, Steve Ferg
<steve.ferg.bitbucket at gmail.com> wrote:
> This is a question for the language mavens that I know hang out here.
> It is not Python related, except that recent comparisons of Python to
> Google's new Go language brought it to mind.
>
> NOTE that this is *not* a suggestion to change Python.  I like Python
> just the way it is.  I'm just curious about language design.
>
> 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.
<snip>
> Does anybody know a language with this kind of syntax for
> ifThenElseEndif?

Ruby:

if count > 10
  puts "Try again"
elsif tries == 3
  puts "You lose"
else
  puts "Enter a number"
end

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list