I'm new to scripting and was interested in how loops work, anyone wanna explain?
The while loop will evaluate the condition to see if it is true or false. If it is false, the loop will end. If it is true, the body of the loop after the 'do' statement will be executed, and the true/false condition will be reevaluated afterward.
Example
local i = 1 while i < 10 do print(i.." < 10") i = i + 1 end print (i.." = 10")
The for loop is a way of running a command or set of commands a set number of times. The basic syntax is as following:
for iterator_variable = start value, end value, increment do
However, there is also a more complicated style of the for loop called the Generic For Loop, but for now we will just discuss the basics.
Keep in mind that as long as the iterator is between the start and end values, the code following the 'do' statement and before the 'end' will be executed.
Example
for i=1, 10 do print("Hello Mom!") end
And for future purposes, please look at the wiki : http://wiki.roblox.com/index.php?title=AllTutorials