What is the difference between single quote strings and double quote strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between single quote strings and double quote strings?

9th Aug 2020, 7:43 AM
Favour Kanyike
Favour Kanyike - avatar
4 Answers
+ 6
As no language is mentioned so I will assume it to be python The answer is that there is no difference between single quote and double quote string.
9th Aug 2020, 7:48 AM
Arsenic
Arsenic - avatar
+ 2
Depends on the language. It is much different e.g. in C++ and PHP
9th Aug 2020, 8:02 AM
Jan Štěch
Jan Štěch - avatar
+ 1
Syntactically there is no difference any quote can be used for any string . But If your string has single quote between characters Prefer using double quote for quoting string and vice versa it's just.
9th Aug 2020, 7:51 AM
Himanshu Sharma
Himanshu Sharma - avatar
+ 1
In some languages like Go, C++ and Java. There is a difference. Single quote indicates a character. Double quote indicates a string. In PHP, string interpolation can not be done with single quoted strings. In some other languages like JavaScript and Python, it does not matter.
9th Aug 2020, 9:32 AM
Ore
Ore - avatar