+ 4
Why use #{} if we just use puts and write he is 42 years old
2 Respostas
+ 1
#{} allows you to personnalize your output
but you can write puts "he is 42 years old"
then everybody are 42 and is a man.
an example:
name = gets.chomp
puts "How old are you, #{name} ?
age = gets.chomp
puts "#{name}, you are #{age} years old. Welcome"
0
So ruby won’t think 42 is a value and think it’s a variable.