Last active
June 1, 2019 15:22
-
-
Save thundergnat/e14ca4f2486f3a2c0c6764a3f603ab5f to your computer and use it in GitHub Desktop.
Bizarre interaction between explict for loop variables and iterators
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
sub wat ($n) { | |
($n .. 1).map: -> $m { say "uno: $m" } | |
($n .. 1).map: -> $m { say "dos: $m" } | |
} | |
for ^2 -> $m { say "|$m|"; wat($m) } # explicit for loop variable | |
say ''; | |
for ^2 { say "|$_|"; wat($_) } # implicit for loop variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment