C3.2 Read and alter existing code, including code that involves conditional statements and other control structures, and describe how changes to the code affect the outcomes
Activity 1: Counting in One-Fifth and Conditional Statements
Ask students to read the code below that skip counts by one-fifth.

Then ask them to alter the code to include the following conditions:
- If the count reaches a whole number, a sound is heard or a movement is seen.
Example

- Whenever a set is complete, the number of sets is displayed.
Example

- The code counts up to 10.
Example

Activity 2: Financial Literacy, Conditional and Other Control Structures
Ask students to read the following code:

Questions to Ask Students | Changes to Be Made |
---|---|
If we move the boxed part inside the condition block, what will happen to the outcome when the code is executed? |
![]() |
Can the code be altered to calculate the cost of several items? | Example of the Code
![]() |
Is it possible to change the tax rate based on the Canadian province or territory? |
|