Skip to content

Instantly share code, notes, and snippets.

@kyrylo
Created December 9, 2012 23:08
Show Gist options
  • Save kyrylo/4247435 to your computer and use it in GitHub Desktop.
Save kyrylo/4247435 to your computer and use it in GitHub Desktop.
precedence
eval "100 + 1\n (42 + 100)" #=> 142
eval "100 + 1\n + (42 + 100)" #=> 142
# But...
eval "100 +\n (42 + 100)" #=> 242
eval "100 +\n + (42 + 100)" #=> 242
# ...
eval "100.+(1\n.+(42 + 100))" #=> 243
eval "100.+(1)\n (42 + 100)" #=> 142
# ,,,
eval "100 +(42\n+ 100)" #=> 200
eval "100 +(42 +\n 100)" #=> 242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment