pascal

Write apostrophe sign in writeln function - Pascal


How can I print the apostrophe sign in Pascal using the writeln function?

Example:

writeln('My brother's book');

wouldn't work because s book is out of "writing" function, so the compiler returns an error:

Fatal: Syntax error, ")" expected but "identifier S" found
Fatal: Compilation aborted

Solution

  • According to the Free Pascal Reference: The single quote character can be embedded in the string by typing it twice:

    writeln('By brother''s book');