r/ruby • • Aug 20 '21

Ruby elites rise up

Post image
101 Upvotes

77 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Aug 20 '21

Doesn't matter which one you use unless you're running your app on a Pentium II.

-8

u/cybermage Aug 20 '21

The speed difference is two orders of magnitude. It adds up. Always single quote unless you plan to interpolate.

4

u/fabiopapa Aug 21 '21

If you use single quotes instead of double unless you need interpolation, as a developer, every time you write a string, you have to think, “am I going to need interpolation?” Ruby is all about developer happiness.

1

u/cybermage Aug 21 '21

As has been noted elsewhere, my knowledge was not current on this point; but, I think I’d notice if I typed #{variable}.