Activity 01
Pair Programming: Loop Control Duel
Pairs write a for loop printing numbers 1-10, then add break to exit at 5 and run it. Next, replace with continue to skip multiples of 3, compare outputs, and discuss differences. Extend to while loop variant.
Differentiate the effects of 'break' and 'continue' statements within a loop.
Facilitation TipFor Pair Programming: Loop Control Duel, pair students with mixed abilities so they teach each other how break, continue, and pass alter loop flow.
What to look forPresent students with three code snippets: one using 'break', one using 'continue', and one using 'pass'. Ask them to write down the output for each snippet and briefly explain why they got that output.