There are a number of special character sequences that can be used between the singlequotes of a character literal or between the doublequotes of a string literal to specify characters, which may otherwise be inaccessible. They consist of two characters. The first is a backslash \. The second may be any character. The meaning is given in the following list
\n
\"
\'- '
*singlequote character*.
Inside a character a singlequote must escaped by the backslash,
because it is otherwise interpreted as end of the character.
- \ \
-
*backslash character*.
Inside a string a backslash must be escaped by another backslash,
because it is otherwise interpreted as first character of
an escape sequence.
`` \b'
\r
\c \c.
Again, if the line is displayed as result of an evaluation, those escape
sequences are displayed in the same way that they are input. They are
displayed in their special way only by Print, PrintTo, or AppendTo.
gap> "This is one line.\nThis is another line.\n"; "This is one line.\nThis is another line.\n" gap> Print( last ); This is one line. This is another line.
It is not allowed to enclose a newline inside the string. You can use
the special character sequence \n to write strings that
include newline characters.
If, however, an input string is too long to fit on a single line it is
possible to continue it over several lines.
In this case the last character of each input line, except the last line
must be a backslash.
Both backslash and newline are thrown away.
Note that the same continuation mechanism is available for identifiers
and integers.
gap> "This is a very long string that does not fit on a line \ gap> and is therefore continued on the next line."; "This is a very long string that does not fit on a line and is therefo\ re continued on the next line."
Note that the output is also continued, but at a different place
that is determined by the value of SizeScreen (see SizeScreen).
GAP 4 manual