Created
January 25, 2014 04:01
-
-
Save heartpunk/8611653 to your computer and use it in GitHub Desktop.
+= is not equivalent to =+. This shows some about how.
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
2.0.0-p247 :005 > pp Ripper.lex('foo += 1');nil | |
[[[1, 0], :on_ident, "foo"], | |
[[1, 3], :on_sp, " "], | |
[[1, 4], :on_op, "+="], | |
[[1, 6], :on_sp, " "], | |
[[1, 7], :on_int, "1"]] | |
=> nil | |
2.0.0-p247 :006 > pp Ripper.lex('foo =+ 1');nil | |
[[[1, 0], :on_ident, "foo"], | |
[[1, 3], :on_sp, " "], | |
[[1, 4], :on_op, "="], | |
[[1, 5], :on_op, "+"], <== this is the unary + operator, which does nothing. | |
[[1, 6], :on_sp, " "], | |
[[1, 7], :on_int, "1"]] | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment