lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I have a question about the design of Lua's for loop.

In my opinion, the syntax:

   for i = 1 to 100

   for n = 79 to 0 step -1

is more in keeping with the general look and feel of Lua's other control flow statements.  I also
find it easier to read, and more self-documenting.  'if exp,exp,exp' is reminiscent of a C 'for'
loop, but it doesn't have the same semantics.  Lua's for loop has the semantics of a 'for' loop in
Basic or Pascal, so why not the same clear, suggestive syntax?

It seems that everything in Lua has been carefully thought out, so I can only assume that the same
amount of thought went into choosing the syntax for the 'for' loop.  How was it chosen?


Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.