|
I've worked enough with Python to see how you want to put 'end' as the last statement at the indentation level of the block it terminates, but most Lua users will have spent more time with curly bracket languages. In that context end isn't a semantic null, it's a "}". I could work with either, but I'd have issues shifting between them... using C and Lua in the same project, for an example.
Signoff
Chris
Top posted because of limitations in the Android 2.1 Gmail client.
On Sep 28, 2010 9:40 AM, "Joseph Manning" <manning@cs.ucc.ie> wrote:On 2010-Sep-27 (Mon) at 10:14 (+0000), Jon Akhtar wrote:
Jon,
>> I know that a lot of code formatting is...
Well, although it's different to the PiL style and to that of most
Lua programmers, I very much prefer to indent the keyword 'end'
to the level of the block which it closes; for example:
i = 0
while i < 10 do
if i % 2 == 0 then
print( i, "is even" )
else
print( i, "is odd" )
end
i = i + 1
end
print( "goodbye for now!" )
My feeling is that since 'end' does not really 'mean' anything
by itself, but is just a syntactic bracket, that it's neater
to tuck it away, aligned with the rest of its block.
Also, it makes it visually easier to spot the next construct,
such as the 'i = i + 1' or the final 'print' in the above example.
Any thoughts, anyone, for or against?
( maybe it's my inner Pythonist struggling to break free,
with indentation denoting nesting :-)
Joseph
------------------------------------------------------------------------
Joseph Manning / Computer Science / UCC Cork Ireland / manning@cs.ucc.ie
------------------------------------------------------------------------