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

Sharpen your programming skills by completing coding exercises that are reviewed by other developers at Upcase today.