Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 4.10 Local Variables and Scope

Description

In this lesson students explore the scoping of a variable, which is where the variable is “defined” or where it exists. In this lesson getting students to define and explain the concept themselves is key.


Objective

Students will be able to:

  • Identify the scope of a variable
  • Identify which variables are in scope at a given point in a program
  • Compare two different variables and determine which has a more specific scope