Created
May 22, 2016 13:21
-
-
Save DougEverly/689f0081898041de80991e66c27f18f1 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 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