LOOPING CONSTRUCTS

Cards (7)

  • Repetition, is used to repeat a block of code until the specified condition is met
  • Initialization setting the initial value of control variable of the loop
  • Condition relational expression that determines when the loop will exit or stop
  • Increment and Decrement defining the control variable to change its value to meet the condition/s so that the loop will be terminated
  • A do-while loop is similar to a while loop except that it always performs at least one iteration even if the condition is false on entry.
  • For loops are used to execute a specific number of times.
  • The syntax of a For Loop consists of three parts separated by semicolons (;). The first part specifies initialization of the loop counter, the second part specifies the condition for continuing with the loop, and the third part specifies incrementing or decrementing the loop counter.