C3.2 Read and alter existing code, including code that involves sequential, concurrent, repeating, and nested events, and describe how changes to the code affect the outcomes.
Activity 1: Nested Events (Counting in Fractional Intervals)
- Ask students to read the code below and describe what the code is doing.
- Discuss with students the outcome of the code.
- Ask students the following questions:
- What is happening with the loop inside another loop?
- How can the code be altered to count in half increments? in quarter increments? in sixth increments?
- How will these changes impact the outcome?
Activity 2: Repetitive and Nested Events (Link to Time)
- Ask students to read the code below and describe what the code is doing.
- Ask students the following questions:
- How will the outcome be impacted if the control block is changed to ? Explain.
- How can the code be altered to represent months and a year? years and a decade? decades and a century?