Mathematics I / Functions and Modularity
Practice question · True or false

If two different functions each define a local variable named count, changing one of them changes the other.

Hints
  1. Ask which function each name belongs to.
  2. Locals are created fresh each time a function runs.
Show the answer

False

Why

False. Each function's count is a separate variable that exists only during that function's execution, so they cannot collide. This independence is what allows functions written by different people to be combined safely.

Read the lesson: Functions and Modularity →

Practise Functions and Modularity

The app has 6 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.

More questions on Functions and Modularity