4. Quotes, escapes and record names
Single and double quotes make text values. Choose the outer quote that leaves the sentence easiest to read. Backticks have a different job: they quote a record name or ID that would otherwise contain spaces, punctuation or a reserved word.
function run()
let line1 = "It's locked."
let line2 = 'The label says "Clockmaker".'
let line3 = "He said \"come in\"."
let lines = "First line\nSecond line"
let tabbed = "Name\tScore"
let slash = "one\\two"
return line1
end| Escape in source | Stored character |
|---|---|
| \n | New line |
| \r | Carriage return |
| \t | Tab |
| \\ | Backslash |
| \" | Double quote |
| \' | Single quote |
A string cannot continue through a literal newline in the source. Use inside it. For a regular expression, the language consumes one level of backslashes: a regex digit group is written "\d+" in PCA source.
function run()
let door = objects.`Archive Door`
return door.name
endThese three are different: "archive_door" is text containing an ID; objects.archive_door is a record reference; a backtick-quoted identifier lets the parser recognize a name. A backtick does not display a speech line.
