Day 5 — Scope

Ron Kagan
An Actor Codes
Published in
2 min readJul 22, 2018

Whoever wrote the instructions that go with this unit over at Codecademy either:
A) has a bit of the poet in him or herself;
or
B) the subject itself just lends itself to such poetry.
Although I suppose too it can be both. Seriously read this:

Scope refers to where a variable can be accessed in a program. While some variables can be accessed from anywhere within a program, other variables may only be available in a specific context. Scope depends entirely on where a variable is declared.

You can think of scope like the view of the night sky from your window. Everyone who lives on the planet Earth is in the global scope of the stars. The stars are accessible globally. Meanwhile, if you live in a city, you may see the city skyline or the river. The skyline and river are only accessible locally in your city, but you can still see the stars that are available globally.

We’ll learn more about scope in this lesson through the use of variables.

I mean, come on! That’s beautiful…

We spend our days accessing certain bits of code nestled inside functions... There’s the getInTheCar block of code for most commuting Americans, and there’s the getTheGroceries program too. These seem important. Indeed, they may be important. These seem like they might be global in their scope to us at the time we’re executing them but I write this a day after my sister decided, on a whim, to not go to the Trader Joe’s that ended up getting rammed into by a man’s car while he fled the police. Thank goodness she just happened to decide not to traipse over across the street with her daughter, which would have put them squarely in what became a three-hour standoff with a gunman who ended up killing the manager of the Silver Lake Trader Joe’s.

It’s awful.

It puts things in perspective. I encourage my fellow Americans to install a script in themselves that runs daily until the epidemic of gun violence is addressed:

Text the word RESIST to Resistbot on Telegram, Messenger, Twitter or to 50409 on SMS* and it’ll find out who represents you in Congress, and deliver your message to them in under 2 minutes. No downloads or apps required.

--

--