Example in Action: "for" Statement

There are also times when you want a program to execute the same code many times. Looping statements are analogous to running laps around a track until some condition is met. Watch this video to see how the "for loop" runs a series of statements multiple times based on a condition.

Remember when using "for loop" statements:

  • make sure to use the correct relational operators in a "for loop";
  • never change the value of the control variable inside the loop; and
  • loops will not execute if the test condition starts as false.


Source: Thomas Bradley, https://www.youtube.com/watch?v=ClT5XRDOEIY (removed)
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License.

Last modified: Tuesday, October 4, 2022, 2:18 PM