Skip to content

Instantly share code, notes, and snippets.

@honix
Last active September 5, 2017 15:24
Show Gist options
  • Save honix/2c72e78bdc4b2d6511283d0436688744 to your computer and use it in GitHub Desktop.
Save honix/2c72e78bdc4b2d6511283d0436688744 to your computer and use it in GitHub Desktop.
Red []
let: func [
binds
block
/local
ctx
][
ctx: context append/only append binds copy [result: do] block
select ctx 'result
]
g: 1
b: 42
let [
a: 100
b: 200
c: b - a
][
a + b + c + g
] ;-- will return 401
b ;-- will return 42 from global context
let [a: 1 b: 2 c: 3] [let [g: 15] [a + b + c + g]] ;-- will return 21
@honix
Copy link
Author

honix commented Sep 5, 2017

Updated/clarified 'let

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment