You cannot multiply two strings : multiply strings « String « Ruby






You cannot multiply two strings



puts '12' + 12
puts '2' * '5'
# <TypeError: can't convert Fixnum into String>

 








Related examples in the same category

1.What if you want to print out a line of text three times?
2.print one word three times, then add or append more text with +
3.you can multiply strings