Presentation is loading. Please wait.

Presentation is loading. Please wait.

LOOPS Loops are lines of code that can be run more than one time. Each time is called an iteration and in for loops there is also an index that is changing.

Similar presentations


Presentation on theme: "LOOPS Loops are lines of code that can be run more than one time. Each time is called an iteration and in for loops there is also an index that is changing."— Presentation transcript:

1

2 LOOPS Loops are lines of code that can be run more than one time. Each time is called an iteration and in for loops there is also an index that is changing each iteration (the index is actually a local). forvalues i = 1(1)6 { display "Iteration #`i'" } Will print: Iteration #1 Iteration #2 Iteration #3

3 LOOPS forvalues i = 1(1)6 { display "Iteration #`i'" } This goes from { to } The first time i =1, then 2, then 3. It stops when it has reached 6.

4 LOOPS forvalues i = 5(2)16 { display "Iteration #`i'" } Will print: Iteration #5 Iteration #7 Iteration #9 Iteration #11 Iteration #13 Iteration #15

5 LOOPS forvalues i = 5(2)16 { display "Iteration #`i'" } That is, the increase is by 2 each time through the loop starting at 5.


Download ppt "LOOPS Loops are lines of code that can be run more than one time. Each time is called an iteration and in for loops there is also an index that is changing."

Similar presentations


Ads by Google