Flow of Control
Class 11 · Computer Science
4 ideas in Class 11 Computer Science, explained in plain words, with games and quizzes to practise.
If Else Branching
Part of: Decisions
If runs on true; else covers false; elif chains many; conditions compare values.
Why it matters. Paths chosen. Cases covered.
Formulas
- if runs its block only when the condition is true
- elif chain checks in order from top to bottom
Key words
- if statement
- : Block running only when its condition holds.
- else
- : Fallback block for the false case.
- elif chain
- : Ordered middle branches between if and else.
- Condition
- : True-false test built with relational operators.
- Nested if
- : One if placed inside another.
Try it in two minutes
- Test condition.
- True path?
- False path?
Try at home. Branch on age.
For Loops
Part of: Decisions
For repeats over sequences; range sets start, stop, step; loops accumulate sums, counts.
Why it matters. Counted repeats done. Sums built.
Formulas
- range(a, b) covers a up to b - 1
- range(a, b, s) steps by s through the span
- Nested m by n loops run the body m x n times
Key words
- for loop
- : Loop repeating once per item of a sequence.
- range
- : Start, stop before, and step of a counted span.
- Excluded stop
- : Stop value never included in the run.
- Accumulator
- : Result built step by step inside a loop.
- Nested loop
- : Loop placed inside another loop.
Try it in two minutes
- Set the range.
- Repeat body.
- Collect result.
Try at home. Sum five numbers.
While Loops
Part of: While Loops Control
While repeats till false; update control variable; infinite loops avoided by progress.
Why it matters. Unknown repeats handled. Progress ensured.
Formulas
- while repeats until its condition turns false
- Every while loop must move its control variable toward exit
Key words
- while loop
- : Loop repeating while its condition stays true.
- Unknown-count loop
- : Loop fit for unknown pass counts.
- Infinite loop
- : Loop whose condition never turns false.
- Control update
- : Statement moving the counter toward loop exit.
Try it in two minutes
- Set condition.
- Update inside.
- Exit cleanly.
Try at home. Count down loop.
Break Continue Pass
Part of: While Loops Control
Break exits loop; continue skips to next pass; pass holds empty blocks.
Why it matters. Flow steered. Blocks valid.
Formulas
- break exits the loop at once; continue jumps to the next pass
- pass holds an empty block that would else be a syntax error
Key words
- break
- : Statement quitting the loop immediately.
- continue
- : Statement skipping to the next loop pass.
- pass
- : Do-nothing holder for an empty block.
- Break on found
- : Stopping a search at its first match.
- Continue on bad data
- : Skipping bad items while averaging the rest.
Try it in two minutes
- Exit with break?
- Skip with continue?
- Hold with pass?
Try at home. Skip evens loop.
What your child will practise
- Break Continue Pass: Jungle Puzzle (Clue Puzzle)
- Break Continue Pass: Jungle Quick Fire (Quick Fire)
- For Loops: Candy Puzzle (Clue Puzzle)
- If Else Branching: Jungle Quest (Flip and Match)
- While Loops: Space Quick Fire (Quick Fire)
- Quiz: Break Continue Pass (8 questions)
- Quiz: For Loops (8 questions)
- Quiz: If Else Branching (8 questions)
- Quiz: While Loops (8 questions)