Skip to content

Commit

Permalink
Merge pull request getify#129 from rcorp/typoInScopeCh1
Browse files Browse the repository at this point in the history
Typo in  scope & closures ch1
  • Loading branch information
getify committed May 3, 2014
2 parents 84a7c89 + 62e55a5 commit a2af854
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scope & closures/ch1.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ A reasonable assumption would be that *Compiler* will produce code that could be

If *Engine* eventually finds a variable, it assigns the value `2` to it. If not, *Engine* will raise its hand and yell out an error!

To summaraize: two distinct actions are taken for a variable assignment: First, *Compiler* declares a variable (if not previously declared in the current scope), and second, when executing, *Engine* looks up the variable in *Scope* and assigns to it, if found.
To summarize: two distinct actions are taken for a variable assignment: First, *Compiler* declares a variable (if not previously declared in the current scope), and second, when executing, *Engine* looks up the variable in *Scope* and assigns to it, if found.

### Compiler Speak

Expand Down Expand Up @@ -202,7 +202,7 @@ var c = foo( 2 );

We said that *Scope* is a set of rules for looking up variables by their identifier name. There's usually more than one *Scope* to consider, however.

Just as a block or function is nested inside another block or function, scopes are nested inside other scopes. So, if a variable cannot be found in the immediate scope, *Engine* consults the next outer containing scope, continuning until found or until the outermost (aka, global) scope has been reached.
Just as a block or function is nested inside another block or function, scopes are nested inside other scopes. So, if a variable cannot be found in the immediate scope, *Engine* consults the next outer containing scope, continuing until found or until the outermost (aka, global) scope has been reached.

Consider:

Expand Down

0 comments on commit a2af854

Please sign in to comment.