Language Reference - Loop Statements

A loop is how you refer to a section of script that you repeat a number of times. You might want to loop a given number of times or you might wish to repeat a section of script as long as a certain condition is true or false.


The following loop statements are available in AutoIt:

While all the statements perform similar functions, they are slightly different and one will usually be more appropriate than another for a given situation.

A loop with little or no interior code will use CPU cycles very rapidly and in the worst case could cause overheating. A Sleep(10) line within the loop is sufficient to prevent this - note that this is not required if the code within the loop contains a blocking function (e.g. MsgBox) or GUIGetMsg.