+ 2

Double or single quotes?

What difference between double or single quotes?When to use them?

22nd Mar 2018, 7:49 PM
HBhZ_C
HBhZ_C - avatar
5 Réponses
+ 7
simple example: does work : print("he is 'smart' ...") doesn't work : print('he is 'smart' ...') try it
22nd Mar 2018, 7:58 PM
voja
voja - avatar
+ 4
The reason the ‘smart’ doesn’t work is because you need the \ sign before each single quote.
22nd Mar 2018, 8:00 PM
Jax
Jax - avatar
+ 3
I don’t believe there is a difference, but I use double, because almost every other language requires double.
22nd Mar 2018, 7:54 PM
Jax
Jax - avatar
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)
27th Mar 2018, 7:15 AM
Max Williamson
Max Williamson - avatar