when to use double quotation marks and when single or blanket? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

when to use double quotation marks and when single or blanket?

as you can see the result that print(eggs) is equel to that print("eggs"). but in some ways,there are big differences between them, for example when in if statements: if 10>5 print("ten is greater than five") , this is all right .but if you delete the double quotation marks,it will makes an error. who can tell me why?thanks a lot.

1st Jul 2017, 3:17 AM
tingting
4 Answers
+ 5
it depends, if you want to print the content of a variable, use double. php
1st Jul 2017, 3:57 AM
Sergio Araya Villalobos
Sergio Araya Villalobos - avatar
1st Jul 2017, 3:59 AM
Sergio Araya Villalobos
Sergio Araya Villalobos - avatar
+ 3
or if you want to concatenate text with the value of the variable. php
1st Jul 2017, 3:59 AM
Sergio Araya Villalobos
Sergio Araya Villalobos - avatar
+ 1
print (eggs) will print the value of eggs print("eggs") will print whatever is written in there i.e eggs
1st Jul 2017, 3:22 AM
‎ ‏‏‎Anonymous Guy