Objectives Students will: 1. Explain what a loop is and describe the three main types of loops used in programming. 1. Дать понятие циклам. И объяснить 3 основных вида циклов используемых в программировании. 2. Practice using loops in Pascal 2. Практическое закрепление. Циклы в Паскале. Студенты ; целей будут :
Vocabulary Instructions Loop Condition Repeat A way to control information A set of orders or directions To do an action a number of times Something which restricts or determines an action
Loops (definition) A loop is used to make a computer do something more than one time. Цикл предназначен для выполнения компьютером действий больше одного раза.
LOOPS Three different types of Loops FOR REPEAT UNTIL WHILE
FOR Loop Jump 5 times or Jump FOR 5 times The command jump is given FOR a specific number of times. In this case it is 5 times.
FOR Loops The for loop is used to repeat a command or action for a specific number of times. This is determined by the program or the user. The loop "counts" the number of times the action will be executed. This loop is a good choice when the number of repetitions is known, or can be supplied by the user.
Repeat Until loop Jump UNTIL I say stop. Instructions are carried out UNTIL a condition occurs. This condition occurs after the instructions are started.
Repeat until Loops A repeat until loop will repeat the instruction UNTIL a condition is met. The computer will start the loop first and will stop after the condition is met. This loop is a good choice when you do not want or need to specify a number of repeats.
While Loop Simon says…..Jump ……………………Jump The condition is checked first before the instructions are carried out. The instructions are carried out while the condition is true.
While Loops A while loop will repeat the instruction AFTER a condition is met. The condition is checked first before the instructions are carried out. The instructions are carried out while the condition is true.