I've noticed that when I'm developing with whitespace agnostic Boo,
the "if, elif, else" constructs require the "end" keyword only once -
at the very end like so:
#-=-=-=-=-=-=-=-=-=-=
if (condition1):
print '1st'
elif (condition2):
print '2nd'
else:
print 'Something else'
end
#-=-=-=-=-=-=-=-=-=-=
However, with the "try, except, ensure" constructs, the "end" keyword
is required after every single block like so:
#-=-=-=-=-=-=-=-=-=-=
try:
raise DirectoryNotFoundException()
end
except e as ArgumentException:
print 'ArgEx'
end
except e as FileNotFoundException:
print 'FNF'
end
except e:
print 'Other'
end
ensure:
print 'The end'
end
#-=-=-=-=-=-=-=-=-=-=
Why the inconsistency? Was this done by design for some reason? I'm
not sure I have a preference between the two methods - the first is
more ruby-ish and cleaner looking, and the second way clearly defines
the end of every block. If you look at the other .NET languages, this
inconsistency doesn't exist - in C# a curly brace ends every block as
in the second example and in VB.NET the whole If and Try blocks are
terminated at the very end like the first example. Either way is
fine, but it makes little sense to mix the idioms.