The ____ control structure is used when a ____ of code needs to be executed a certain number of times. ____ provides two types of repetition structures; the ‘while’ and ‘for ____. Both loops perform the same function: to check whether a certain ____ is true or not. If the condition is true, the program will execute the instruction(s) inside the loop repeatedly; until the condition is no longer ____. When that happens, the program will skip the loop and will start executing the code that comes after it While-loopThe while-____ checks the control variable condition continuously. If the condition is ____, then the code between the curly braces ({...}) is executed sequentially. Once the ____ is done executing the instructions inside the while-loop, it returns to the top of the loop and checks the condition again. If the condition is still true, the ____ executes again. The process will repeat until the while-loop expression/condition becomes ____. When that happens, the program will skip the while-loop and will execute the code that comes after it initialise the control ________() { set pin#12 as output //red LED set pin#7 as output //blue LED while (control variable) { turn red LED ON wait 0.5s (500ms) turn red LED OFF wait 0.5s (____) i=i+1 } turn red LED OFF turn blue LED ON } ____() { } For-loopThe for-loop performs exactly like the while-loop, in the sense that it ____ whether a certain condition is true or not. If the condition is true, then the program will run the loop’s block of code ____. When the condition is no longer true, the program will ____ the instructions inside the loop and will start executing the code that comes after it. However, the code ____ for the for-loop is different than that of the while-loop. The for-loop has three arguments; the initialisation of the loop’s control ____, the loop-continuation condition, and the control variable expression. ____() {set pin____12 as output // LED } ____() { for (initialise the control ____ i; i<3; increment i ) { turn LED ON wait 200ms turn LED OFF wait 200ms i=i+1 } turn LED OFF ____ 5s ____

Repetition control structure

Leaderboard

Visual style

Options

Switch template

Continue editing: ?