Skip to content

Instantly share code, notes, and snippets.

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

  • Save DougEverly/25bd66059735df4b6e480c204f983dd8 to your computer and use it in GitHub Desktop.

Select an option

Save DougEverly/25bd66059735df4b6e480c204f983dd8 to your computer and use it in GitHub Desktop.
def foo
yield
end
def run : Int32
# must declare i here to use in this scope
i = nil
foo {
i = 2
}
# since its Int32|Nil, must cast
return i.as(Int32)
end
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment