Hacker News new | ask | show | jobs
by dragonwriter 2039 days ago
interpolation isn't the only difference between single- and double-quoted strings. If you need control, etc., characters via backslash escapes, you must use double (or semantic equivalents like %/%Q). If you need non-eyesore strings with literal backslashes, you need single (or semantic equivalents like %q.)

  irb(main):001:0> puts '1\t2',"1\t2"
  1\t2
  1       2
> In Ruby, knowing that a string has interpolation is easy enough by seeing the #{} in the middle of it.

{} are not required for instance variables.