[Oberon] LONGINT, RETURN & etc.
arturefimov at gmail.com
Sun Jun 18 12:32:10 CEST 2017
> RETURN " " END is valid
This is not valid, because in Oberon, a functional procedure can not have
ARRAY OF CHAR as return type (nor can it return a RECORD). The valid return
types are INTEGER, REAL, CHAR, BOOLEAN, SET, POINTER TO ...
"RETURN END" is not a valid construct in an Oberon program not because of
the because of the syntax rules, but because of the semantic rules. To show
the difference, consider this statement:
IF '5' < 10 THEN END. This is an absolutely valid statement syntaxically,
but it is not valid because of the type mismatch (you can't compare
expression of type CHAR to an expression of type INTEGER).
> LOOP would be a more generic way iso using REPEAT and/or WHILE.
LOOP can not replace REPEAT and/or WHILE. LOOP + IF can, but not LOOP by
If you want to make the Oberon compiler restrict programmers to only use IF
... THEN EXIT END statement in the beginning or in the end of the LOOP
statement, and only once, then the source code of the compiler will get a
lot more complex, as this would no more be a syntax rule, but a semantic
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon