" vs ' in strings

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!')
4 Likes

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")
4 Likes

You can also do this, I’m pretty sure, lol:

	print([[Hello!]])

2 Likes

Same with quotation marks.

print("Do \":cmds\" for a list of commands")

Expected output:

-- Do ":cmds" for a list of commands
3 Likes

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 :stuck_out_tongue::

print(proof [============[ LOL ]============] proof)
3 Likes