I know about [[these strings]] but I saw something with a backslash once. I forgot how it worked but it was something like this.
print("one /n two")
The backslash escapes the next character in after it in a string. This lets you make special characters, like the newline character, "\n"
:
print("one\ntwo") -- one -- two
You can also make strings with [[
and ]]
instead of "
. These don't allow escaping, but you can contain a newline in them plainly:
print([[one two]]) -- one -- two
Finally, you can escape a literal newline using a backslash:
print("one\ two") -- one -- two
That last one is almost never done, though.
In such a simple case where you know ahead of time where you want your newlines, it makes more sense to just break them into two print statements. It will be easier to read and maintain that way.
print("one") print("two")