I'm quite confused here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm quite confused here

What is the difference between a double quote string and single quote string.? Please help.

25th Jun 2017, 7:05 PM
Whitecode_special.
Whitecode_special. - avatar
3 Answers
+ 3
If you have a single quote string than you can't put inside special symbols and values of variables for execution. For example: a=5 puts "First string\nSecond string#{a}" #outputs: First string Second string5 a=5 puts 'First string\nSecond string#{a}' #outputs: First string\nSecond string#{a}
25th Jun 2017, 7:24 PM
Александр Громозонов
Александр Громозонов - avatar
+ 3
Anything within single quotes is interpreted literally. Eg. \n will remains as \n Single quotes does not support string interpolation #{} and escape sequences \n.
26th Jun 2017, 12:40 AM
SC Lee
SC Lee - avatar
0
Gracias!! Thanks!
29th Jun 2017, 7:56 PM
Whitecode_special.
Whitecode_special. - avatar