Add numbers - concatenate strings
-
-
Interpolation works on numbers as well
-
The
+operator is numerical addition or string concatenation
x = 23
y = 19
z = x + y
puts z # 42
puts "#{x} + #{y} is #{z}" # 23 + 19 is 42
a = "23"
b = "19"
c = a + b
puts c # 2319
puts "#{a} + #{b} is #{c}" # 23 + 19 is 2319