Introduction to the Pascal Programming Language
© 1998 by Dr. Thomas W. MacFarland -- All Rights Reserved
Instructions: Review the following program and see if you can predict the outcome by completing a "pencil trace" of the code. Program output is provided at the end of this page. Compiler: The program was prepared using Standard Pascal on a UNIX-based host computer.
% cat PASCAL/intro_pencil-02.p
{ Introduction to the Pascal Programming Language
Dr. Thomas W. MacFarland
intro_pencil-02.p
}
{ The purpose of this program is to:
1. Demonstrate the write statement and the writeln
statement.
2. Demonstrate cursor-control differences between the
write statement and writeln statements.
3. Demonstrate how the write statement must have an
argument, while it is acceptable to use writeln
without an argument.
}
program Demonstrate_Another_Cursor_Control_Program;
begin
writeln('This program ');
write('is fairly simple.');
write;
write('Yes or no?');
end. { intro_pencil-02.p }
% pc PASCAL/intro_pencil-02.p
Thu Aug 20 20:11:10 1998 PASCAL/intro_pencil-02.p:
E 10560 line 24 - Write requires an argument