Cards (15)

  • Iteration is code which repeat a certain sequence a number of times depending on certain conditions.
  • A FOR loop is a type of iteration that will repeat a section of code a known number of times. Also known as a count-controlled loop.
  • A loop counter is a variable that is used within a FOR loop to keep a record of the amount of times the loop has been repeated. The loop counter normally increases by 1 each time the loop is executed.
  • An infinite loop is a loop that will iterate indefinitely. Usually caused by a logical error in the condition that controls the loop.
  • A WHILE loop is a type of iteration that will repeat a sequence of code while a set of criteria continues to be met. They are also known as pre-condition loops because the condition is checked before the loop executes. If the criteria are not met before the loop starts, the loop will not run and the code within it will not be executed.
  • Condition-controlled loops are types of iteration where the repetition of the loop is determined by conditions. The amount of times the loop will be executed is unknown.
  • A REPEAT…UNTIL loop is a type of iteration that will repeat a sequence of code until a certain condition is met. The code within the loop will always be executed at least once. They are known as post condition loops.
  • Iteration provides methods that programmers can use to loop through sequences of code multiple times. There are three basic forms of iteration: FOR loops, WHILE loops, and REPEAT…UNTIL loops.
  • Loops in flowcharts are shown through the use of a decision element (diamond shape) with a flow line looping back to an earlier element of the diagram. The decision element contains the criteria on which the iteration is based.
  • A FOR…TO…NEXT loop is used where the number of iterations is known as the outset.
  • A FOR loop contains a loop counter to record the number of iterations. They are known as count-controlled loops. This value can be used within the code in the FOR loop.
  • Condition-controlled loop structures, such as WHILE…DO…ENDWHILE or REPEAT…UNTIL, are used where the number of iterations is unknowns.
  • WHILE…DO…ENDWHILE structures check the loop conditions at the outset of the loop. They are known as pre-condition loops. If the conditions are False, the loop will never run.
  • REPEAT…UNTIL structures check the loop conditions at the end of the first iteration. They are known as post-conditions loops. The loop will always run at least once.
  • Nested iteration is when one loop is contained entirely within another loop. It is used to run an iterative process more than once.