Tenth graders learn variable scope — where in a program a variable can be used. Local variables live inside their function; global variables work across the program. Understanding scope prevents a whole class of bugs. They check the ideas, then trace scope in code.
Students will be able to…
Why does a variable sometimes work in one place but not another?
Project each one and have students answer about variable scope.
Tap any phase to open the teacher moves and student actions.
Why might a variable give a "not defined" error in one spot?
Students learn.
Students practice.
Students apply.
Students close.
Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.
Understand variable scope.
Document variable use.
Debug scope errors.
Reason about program state.
Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.
Have students trace local vs global scope in a program. A printable scope sheet is in the CS library.
Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.
A quick self-check with instant feedback, drawn from this lesson’s key terms.
A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.