Created
May 22, 2016 13:16
-
-
Save DougEverly/25bd66059735df4b6e480c204f983dd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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