lua-users home
lua-l archive

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

----- Original Message -----
From: Axel Kittenberger
Date: 11/19/2010 2:00 AM
I've another idea how to capture full loop functionality, in a way
I've not yet seen in another language.
1) continue as new keyword - better just get over with it, than to
overload existing keywords with new functions that are contrary to
their everyday meaning - like break as continue..
2) let continue take an optional argument to how often call the
iterator for for loops.

continue   -- like in C, do next iteration
continue 1 -- synonymous to continue - call iterator once
continue 0 -- goes to start of loop calling the iterator 0 times - "redo"
continue 2(or more) -- calls the iterator twice, skiping one

continue -1 -- error! cannot reverse iterate (with n..m..k loops this
might theoretically work, but not with genericf for loops)

thinking about e.g. argument parsing, this continue X would be a dream!
FWIW, both proposals are interesting, but I would be happy with just a simple 'continue' keyword that works according to the already existing patch for Lua 5.1.