The generic for loop
An example of a for loop using an iterator
local planets = {"Earth","Mars","Saturn","Venus"} for item in iterator(planets) do print (item) end
- The generic for loop allows (see code below):
- The var-list to be a list of one or more variables names
- Separated by commas
- The exp-list to be a list of one or more expressions
- Separated by commas (usually this has one element)
- The var-list to be a list of one or more variables names
Syntax of the generic for loop
for <var-list> in <exp-list> <body> end