Last active
September 5, 2019 18:09
-
-
Save bcardiff/05482bb9dddeacf41856 to your computer and use it in GitHub Desktop.
for crystal
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
macro for(expr) | |
{{raise "invalid syntax. use for e in c." unless expr.args.first.name.stringify == "in"}} | |
{{expr.args.first.args.first}}.each do |{{expr.name.id}}| | |
{{expr.args.first.block.body}} | |
end | |
end | |
for e in 1..5 do | |
puts e | |
end | |
for e in [1,2,3,4] do | |
puts e | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment