rubystringquotesdouble-quotessingle-quotes

Double vs single quotes


Is there a specific time when I should use "" vs ''?

I've been using single quotes most of the time because it's easier to type but I'm not sure if I should.

e.g. get 'user/new' vs. get "user/new"


Solution

  • " " allows you to do string interpolation, e.g.:

    world_type = 'Mars'
    "Hello #{world_type}"