-
-
Save anonymous/3452a0521988f3836ea1e4e7b362a958 to your computer and use it in GitHub Desktop.
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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment