Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 362 Bytes

scopes.md

File metadata and controls

17 lines (13 loc) · 362 Bytes

Scopes

Pangaea uses lexical scope. Closures can refer outer function's variables.

{|outer|
  {|inner| inner + outer}
}(2)(3) # 5

Note that compound assignments do not affect outer scope variables. This is just shadowing (inner scope variable a := 2 shadows outer scope variable a := 1).

a := 1
{a += 1; a.p}() # 2
a.p # 1