String Addition and Multiplication
Explore how Ruby treats string addition as concatenation and string multiplication as repetition. Learn to manipulate strings effectively with examples like joining strings, multiplying characters, and formatting output for clearer code.
We'll cover the following...
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?
We can replace line 3 and 4 with a single line, like this:
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 given above, we ...