+ 2

What is difference between double quotes and single quote?

20th Feb 2018, 4:12 AM
Zenith Gajera
7 odpowiedzi
+ 5
In python, there is no set difference, and its just a matter of convenience at the developer's end that he/she chooses double or single quotes. One may use double quotes when the strings include apostrophes. Eg : print("You can't use single quotes in between single quotes without escaping..."); Now, if you used single quotes, you would need to escape the quote in between, with a single backslash character. Eg : print('You can\'t use single quotes in between single quotes without escaping...'); For more information, read here : https://stackoverflow.com/questions/56011/single-quotes-vs-double-quotes-in-python
20th Feb 2018, 4:26 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 11
In C++, single quotes are used for a single character while double quotes is used for a string. Example: char c = 't' //It's a single character string s = "Hello" //It's a word
20th Feb 2018, 7:11 AM
Alex Shaw 😻
Alex Shaw 😻 - avatar
+ 3
This is heavily dependent on the language as some just consider all strings to be strings, others consider double quotes a string and single quotes characters, and others will not interpret expressions in single quotes but will do so for double quotes.
20th Feb 2018, 4:38 AM
Tom Shaver
Tom Shaver - avatar
+ 2
In which language?
20th Feb 2018, 4:15 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
20th Feb 2018, 4:16 AM
Zenith Gajera
+ 2
usually single quotes are used for one character. Double quotes are used for strings of characters.
20th Feb 2018, 4:21 AM
Tim Millar
Tim Millar - avatar
+ 2
variables dont work inside single quotes in php
20th Feb 2018, 4:49 AM
Toni Isotalo
Toni Isotalo - avatar