diff --git a/doc/pascalprogramming.md b/doc/pascalprogramming.md index d221f55..53b7dff 100644 --- a/doc/pascalprogramming.md +++ b/doc/pascalprogramming.md @@ -39,6 +39,16 @@ The _in_ operator also works for linear arrays, so the _if_ statement will have Note that the array _in_ operator will be more inefficient for larger ranges (i.e. `'A'..'z'`), but more efficient for sparse sets (i.e. `'A','z'`). +## Break and Continue Statements + +Wirth Pascal has no statement to exit a loop. Other Pascal dialects have the _break_ and _continue_ statements to exit the loop or skip to the next iteration. + +Tridora-Pascal only supports the _break_ statement at the moment. + +## Exit Statement +The _exit_ statement can be used to exit the current procedure or function. If it is a function, the return value of the function is undefined if _exit_ is +used before a return value is assigned. + ## I/O I/O handling in Tridora Pascal is mostly compatible with other Pascal dialects when reading/writing simple variables from/to the console. There are big differences when opening/reading/writing files explicitly. @@ -113,6 +123,22 @@ begin end; ``` +Possible error codes from _IOResult_ are: +|Value|Constant Identifier| Description| Notes | +|---|-------------------|------------|-------| +| 0 | IONoError | no error | | +| 1 | IOFileNotFound | file not found | | +| 2 | IOVolNotFound | volume not found | | +| 3 | IOPathInvalid | path invalid | | +| 4 | IOFileExists | file already exists | | +| 5 | IOFileClosed | file closed | | +| 6 | IOSeekInvalid | seek invalid | | +| 7 | IONoSpace | no space | | +| 8 | IOReadOnly | file is readonly | | +| 9 | IOInvalidOp | invalid operation | | +| 10 | IOInvalidFormat | invalid format | when parsing numbers with _read_ | +| 11 | IOUserIntr | interrupted by user | program terminated by ^C, not visible from _IOResult_ | + ### Read, Readln and Line Input In Turbo Pascal, using _read_ (and _readln_) from the console always waits until a complete line has been entered. Tridora-Pascal handles this like UCSD-Pascal, that is, it immediately @@ -136,6 +162,12 @@ var c:char; ``` +## Labels + +In Wirth Pascal, labels must be numbers. Other Pascal dialects also allow normal identifiers (i.e. start with letters then letters and digits). + +Tridora-Pascal only allows identifiers as labels. + ## Compiler Directives Tridora-Pascal understands a small number of compiler directives which are introduced as usual with a comment and a dollar-sign. Both comment styles can be used.