+ 1
I'm quite confused here
What is the difference between a double quote string and single quote string.? Please help.
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}
+ 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.
0
Gracias!! Thanks!