-1

What is the difference between double quotation marks "" and single quotation marks '' in Ruby?

As far as I have seen this seems to only be a choice of preference and there is no change in function unless the two are accidentally mixed, ie "Some String'.

user513951
  • 12,445
  • 7
  • 65
  • 82
Berg Dodson
  • 53
  • 1
  • 4

1 Answers1

0

Double-quotes interpolates.

Single-quotes do not, e.g.,

puts "Hi #{42+5}"
=> "Hi 47"

puts 'Hi #{42+5}'
=> "Hi #{42+5}"
Dave Newton
  • 158,873
  • 26
  • 254
  • 302