Download presentation

Presentation is loading. Please wait.

Published byNathan McNeil Modified over 3 years ago

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.

Similar presentations

OK

EC-111 Algorithms & Computing Lecture #11 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.

EC-111 Algorithms & Computing Lecture #11 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google