I’ve seen many people use ` for strings instead of ", I just wondering if there was a difference, or if it’s just preference.
Example
print("Hello, world!")
-------------------
print('Hello, world!')
I’ve seen many people use ` for strings instead of ", I just wondering if there was a difference, or if it’s just preference.
print("Hello, world!")
-------------------
print('Hello, world!')
It is just preference.
They are the same for the most part.
If you want to have contractions in your single-quote string you need to escape the apostrophe.
print('You\'re epic')
print("You're epic")
You can also do this, I’m pretty sure, lol:
print([[Hello!]])
Same with quotation marks.
print("Do \":cmds\" for a list of commands")
Expected output:
-- Do ":cmds" for a list of commands
Correct. I used contractions as an example because those are common to print for debugging.
You can use any one, but typically people use " "
for everything. I like using ' '
for single characters and " "
for everything else.
Those two aren’t even the only ones that exist, you can also use these if you want:
print('hi')
print("hi")
print([[hi]])
print([=[hi]=])
The last one can have as many equal signs as you want, so you can technically do this if you felt like it :
print(proof [============[ LOL ]============] proof)