I wonder what the differrence between ' and " is | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I wonder what the differrence between ' and " is

It seems both of them can be used when it comes to a string.Am I right? Thanks.

19th Aug 2016, 8:43 AM
majiaxin
2 Answers
+ 7
Both can be used however there are slight differences. Eg ' can be confused with an apostrophe so if you are printing the string 'don't do that' the computer will see the apostrophe in the don't as the end of the string. There are ways to get around this such as using a backslash(\ )before the apostrophe in don't. Eg: print 'don\'t do that' The backslash tells the computer to ignore the apostrophe and see it as part of the string. Another way of printing the string is to simply use double quotes eg: Print "Don't do that"
19th Aug 2016, 8:50 AM
andyl9
- 1
yeah that is escape. You should know bout escape
19th Aug 2016, 2:48 PM
june song
june song - avatar