uno o dos

Jared Carroll

Now in Ruby, strings can be created using single or double quotes. The only difference is that you can interpolate variables in double quoted strings. I constantly see the following confusing code: = "name"

link_to "home", root_path

Here we’re using double quoted strings, but there’s no interpolation. As soon as I see double quotes, I think there’s going to be some interpolation. Using double quotes without interpolation is flat out wrong. The above code is more correct, and much less confusing using single quotes. = 'name'

link_to 'home', root_path

This may not seem like much, but it makes a huge difference when followed consistently.

Jared Carroll

Pair with one of our expert developers to level up your skills with Coaching by thoughtbot. Save time learning best practices and techniques for reducing technical debt in Ember, Ruby, Haskell, and Go in 1-on-1 sessions tailored to your goals.