Pascal Programming/Input and Output
Before you learn more about Pascal it is important to know how to actually do something. For now, we will use console input and output. Here is an example of how output is done:
program output; begin writeln(1); write('1'); end.
writeln() displays what ever is in the parentheses and prints a "new line character", making newly displayed characters start on the next line.
; is simply grammatical; it just separates the two statements.
write() displays what ever is in the parentheses without printing a "new line character".
Do note that characters and strings must be placed within single quotation marks. You may have noticed that
writeln work for more than one type. You may also wonder how
write('1') could do the same thing yet,
'1' be represented in completely different ways. Like wise, how
'1' may be represented the same way yet,
write('1') don't do the same thing. The answer is that compiler always knows the type and thus how it's formatted.
end. </source> As you notice, the parentheses are not required when no parameters are present.