Skip to content

Instantly share code, notes, and snippets.

@DougEverly
Created May 22, 2016 13:21
Show Gist options
  • Select an option

  • Save DougEverly/689f0081898041de80991e66c27f18f1 to your computer and use it in GitHub Desktop.

Select an option

Save DougEverly/689f0081898041de80991e66c27f18f1 to your computer and use it in GitHub Desktop.
def inner_scope(*args)
return yield(*args)
end
def run : Int32
# must declare i here to use in this scope
i = inner_scope(3, 2) { |args|
x, y = args
i = x + y
}
# since its Int32|Nil, must cast
return i
end
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment