'I remarked "Nice night, isn't it?"'
As is, that line of code causes an error because the interpreter
thinks that the string literal ends with the apostrophe in the word
"isn't." The interpreter reads it as:
'I remarked "Nice night, isn' // The rest is considered unintelligible garbage
To use the single quote inside a string literal delimited by single
quotes, we must use an escape sequence.
An escape sequence represents a literal string value using a
backslash character (\), followed by a code that represents the
desired character or the character itself. The escape sequences for
single and double quotes are:
\'
\"
So, our cordial evening greeting, properly expressed as a string
literal, should be:
'I remarked "Nice night, isn\'t it?"' // Escape the apostrophe!