Scoping Scope
#ruby
There's one more special (and, you might say, evil) side to a variable: scope. The scope of a variable is the part of the program to which a variable is visible. If you try to access a variable from outside its scope (for example, from a part of an application to which that variable is not visible), your attempts will generally fail.
Scoping Scope Scope is a big concept in most programming languages, and understanding it is a true way to hone your craft. I wish I could spend more time on scope, but since I can't, check out this article on SitePoint in your spare time. The notable exception to the rules defining a variable's scope are global variables. As the name implies, a global variable is accessible from any part of the program. While this might sound convenient, using global variables is discouraged—that they can be written to and read from any part of the program introduces security concerns.
If you want to change selection, open original toplevel document below and click on "Move attachment"
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details