while loops

Syntactically, a while loop starts with the while keyword, followed by a Boolean condition and a do/end chunk. The loop will keep executing the chunk of code so long as the Boolean condition evaluates to true:

x = 10 -- Initialize a "control" variable

while x > 0 do -- Boolean condition: x > 0
print ("hello, world")

x = x - 1 -- Decrement the "control" variable
end
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.218.45