+ 2
Double or single quotes?
What difference between double or single quotes?When to use them?
5 Réponses
+ 7
simple example:
does work :
print("he is 'smart' ...")
doesn't work :
print('he is 'smart' ...')
try it
+ 4
The reason the ‘smart’ doesn’t work is because you need the \ sign before each single quote.
+ 3
I don’t believe there is a difference, but I use double, because almost every other language requires double.
0
Double quotes are better /s
it doesn't really matter provided that strings start and end with the same one, but it's more convenient personally for me to use double because I rarely have to include speech in string and therefore use the ' character more often within strings and not having to put a \ (which is halfway across the keyboard) makes things quicker(and nicer looking)