Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write apostrophe sign in writeln function - Pascal

Tags:

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
like image 789
Vukašin Manojlović Avatar asked Nov 01 '12 09:11

Vukašin Manojlović


People also ask

How do you writeln in Pascal?

write\writeln For this, Pascal has the predefined functions write and writeln. The syntax is write(outputdata) or writeln(outputdata), where outputdata is any variable or a text you specify. If it is text, you have to give it in quotes, that is like write('I'm a student'). Do not forget the semicolon after each line.

What is the purpose of writeln of Pascal?

WriteLn does the same as Write for text files, and emits a Carriage Return - LineFeed character pair after that. If the parameter F is omitted, standard output is assumed. If no variables are specified, a newline character sequence is emitted, resulting in a new line in the file F .

What is the purpose of writeln?

Definition and Usage The writeln() method writes directly to an open (HTML) document stream. The writeln() method is identical to the write() method, with the addition of writing a newline character (U+000A) after each statement.


1 Answers

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');
like image 64
Lars Noschinski Avatar answered Oct 26 '22 15:10

Lars Noschinski