Created
August 2, 2015 00:29
-
-
Save singularperturbation/de5d2b5239e9751ce1b0 to your computer and use it in GitHub Desktop.
Repro for #3140
This file contains 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
iterator doStuff*(str: string, endpos = int.high): int = | |
# let strlen = if endpos == int.high: str.len else: endpos+1 | |
# yield strlen | |
if endpos == int.high: | |
yield str.len | |
else: | |
yield endpos+1 #ERROR - Will not compile | |
for num in doStuff("HEY"): | |
echo num | |
proc doStuff2(str: string, endpos = int.high): int = | |
if endpos == int.high: | |
return str.len | |
else: | |
return endpos+1 | |
echo doStuff2("HEY") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment