String Addition and Multiplication
Learn to implement string addition and multiplication in Ruby.
We'll cover the following...
Editing age
program
Let’s look at the program from the previous chapter. Can we improve it in any way?
Press + to interact
# A simple Ruby Program using variableage = 20 # Variableputs "Your age is"puts age
We can replace line 3 and 4 with a single line, like this:
Press + to interact
# A simple Ruby Program using variableage = "30" # Variableputs "Your age is " + age
Something is missing, isn’t it? That’s right, the space is missing between the word “is” and the number “30”. As we can see from the example ...