Skip to content

Instantly share code, notes, and snippets.

@singularperturbation
Created August 2, 2015 00:29
Show Gist options
  • Save singularperturbation/de5d2b5239e9751ce1b0 to your computer and use it in GitHub Desktop.
Save singularperturbation/de5d2b5239e9751ce1b0 to your computer and use it in GitHub Desktop.
Repro for #3140
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