Scope
Scope, to my understanding, is all the different levels of the program. I think the best personal example I can think of is a book. Books consist of the "book," or top-level, chapters, or different methods, and the literature (or just words). Variables can take place on various levels of your scope, so it's important to consider when writing a program the organization and scope of your variables. When I last posted on stackoverflow, I got asked why I used global variables ($), especially because Ruby makes it almost unnecessary. This would be... me not thinking about my scope.Stacking
I posted my first question at stackoverflow on a stack error. Stacking essentially is Inception, or how many levels deep you go. Fortunately (or unfortunately, depending on how you look at it), computers only allow so many stacks, probably in the tens of thousands. I know you can increase it manually, but most of the time it's not necessary. Anyway, if you're using recursion, and the stacking NEVER STOPS, you'll eventually run into a stack error. They look a little different between Ruby:SystemStackError: stack level too deep
and JavaScript: RangeError: Maximum call stack size exceeded
but mean the same thing. Bright side of things: I can create a stackerror on command. The world is mine... recursively.Branching
If you can figure out stacking pretty well, branching is the idea of working with a flow chart. Eloquent JavaScript adds to this mix or even more lucrative branching, letting more than branch work at the same time using ||, the computer equivalent of "or." I'll post an example of this later tonight in Ruby, borrowing the original example from Eloquent JavaScript just to practice my Ruby skills... or rather translation skills.Till then! Time to make dinner, and then back to go from learning to using.
No comments:
Post a Comment