Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # In the tutorial https://www.tutorialspoint.com/ruby/ruby_syntax.htm
- # there is a quote:
- # Whitespace characters such as spaces and tabs are generally ignored in Ruby code,
- # except when they appear in strings. Sometimes, however, they are used to interpret
- # ambiguous statements. Interpretations of this sort produce warnings when the -w
- # option is enabled.
- # Example:
- # a + b is interpreted as a+b ( Here a is a local variable)
- # a +b is interpreted as a(+b) ( Here a is a method call)
- # However, this program prints out "3\n3\n" instead of crashing when trying to apply
- # a to the value positive b. So there must be more to it than that, right?
- a = 1
- b = 2
- c = a + b
- # I do get a warning for this next line, however it parses it the same as the previous.
- d = a +b
- puts c
- puts d
Add Comment
Please, Sign In to add comment