The code you provided demonstrates iteration. Here's a breakdown of the three basic programming constructs:
-
Sequence: This refers to the execution of statements in a linear, step-by-step manner. Each line of code executes one after the other.
-
Selection: This involves making decisions in the code, typically using conditional statements (like
if
,else
, etc.) to execute certain blocks of code based on conditions. -
Iteration: This involves repeating a block of code multiple times, usually with a loop structure (like
while
,for
, etc.).
The code snippet you provided uses a while
loop to repeatedly print "Carry on playing..." until the timer
is no longer greater than 0. Hence, the correct usage in your context is iteration.