I'm doing the Ruby 20 minute tutorial on ruby-lang.org and I came across this code messing with the irb:
irb(main):015:0> def h(name)
irb(main):016:1> puts "Hello #{name}!"
irb(main):017:1> end
based on the explanation, the #{name}
part is just adding the variable to the string? I thought this was an odd and verbose way of writing it so I just thought I'd try "Hello" + name
and it worked exactly the same way..
I googled around trying to find a meaning to #{}
and I cant find anything talking about it so I thought I'd ask the community.. what is the difference? Is there one?
Thanks in advance!