A line or block of code that influences the order in which other code is executed. Control structures affect the flow of the program and include sequencing lines of code, repeating lines of code (loops), or selection to execute or not execute specific lines of code (conditional statements). Sequence, repetition, and selection are all control structures.
The example above uses sequential code, repetition, and selection to make the magic 8 ball operate. The loop allows the magic 8 ball to operate continuously while the conditional statements allow different responses to be chosen randomly. Having students create and alter code of this nature corresponds with Mathematics Grade 6 C3.1, 3.2, D2.1 , 2.2