For

From MiniScript Wiki
Revision as of 01:06, 8 May 2022 by LPopoca (talk | contribs) (Created an example for iterating over a range of numbers and an example of iterating over a list.)
Jump to navigation Jump to search

for is a keyword used to loop over a sequence (i.e. a list, map, or string).

Example

Iterate over a range of numbers

for i in range(1,10)
    print i
end for

Example

Iterate over a list

words = ["hello", "MiniScript", "wiki"]
for word in words
    print word
end for