Ruby – Double vs single quotes

rubystringsyntax

I'm really new to Ruby and I'm trying to understand if there's 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"

Best Answer

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

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