Presentation is loading. Please wait.

Presentation is loading. Please wait.

GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.

Similar presentations


Presentation on theme: "GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used."— Presentation transcript:

1 GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used in programming COULD explain when each type of loop would be used and apply to a given programme. Apply an appropriate loop to a programme

2 GCSE Computing#BristolMet Key Words

3 GCSE Computing#BristolMet Count-Controlled Loop This is mostly known as a FOR loop and is used when a start and end point for the loop is known, i.e you know how many times you want that section of code to repeat for. A variable is used to count how many times it should repeat FOR = TO NEXT e.g FOR i = 1 TO 5 OUTPUT i i = i + 1 NEXT What will this programme do?

4 GCSE Computing#BristolMet Condition – Controlled Loops When the number of loops required is not known then a condition can be created to determine whether the code should be repeated or not. This is called condition controlled looping and one kind is the WHILE loop. WHILE END WHILE The loop is repeated while the condition is true and exits when false. Another kind of condition controlled loop is the REPEAT UNTIL loop. REPEAT UNTIL Notice the difference, the repeat does the instructions and then ask the question. While asks the question first.

5 GCSE Computing#BristolMet Looping Tasks TASKS: Create a program that counts 1 to 5. What kind of loop will you use? Can you use any other types of loop for this program. Discuss and attempt to create. What is an infinite loop and how would you write one? Adapt your multi-calculator programme so that it gives the user the option of continuing or exiting the programme. Prepare to explain, using keywords, how this could be achieved. Now develop your flow chart and then code it.


Download ppt "GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used."

Similar presentations


Ads by Google