Ruby single and double quotes

后端 未结 6 1005
情话喂你
情话喂你 2020-11-30 15:01

I\'ve recently been coding in Ruby and have come from Python, where single and double quotes made no difference to how the code worked as far as I know.

I moved to R

6条回答
  •  悲哀的现实
    2020-11-30 15:41

    You should read the Literals section of the official Ruby documentation.

    It is very concise, so you need to read carefully. But it explains the difference between double-quoted and single-quoted strings, and how they are equivalent to %Q/.../ and %q/.../ respectively.

提交回复
热议问题