-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
  • 11,572
  • 7
  • 61
  • 75
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
  • 156,572
  • 25
  • 250
  • 300