up previous next
NewLine

string containing a newline

Syntax
NewLine() :STRING

Description
This function returns a string containing a newline. It is simply defined as Return Ascii(10); in coclib.cpkg .

In CoCoA-5 newlines are not allowed in string literals (too often we have forgotten to close the quotes and the rest of our program ends up in the string!). So newlines must be inserted in a very explicit manner: either with NewLine() or with \n .

Example
/**/  Print "a", NewLine(), "b";
a
b

/**/  Str :=
      "This is a multiline string" + NewLine() +
      "This is the second line\n""This is the third!";
/**/  Print Str;
This is a multiline string
This is the second line
This is the third!

See Also