[Oberon] Oberon System 3 on WIndows: Why does the step size in FOR-loop have to be a constant expression?

Jörg Straube joerg.straube at iaeth.ch
Sun Dec 9 22:15:54 CET 2018


Use WHILE if step size is variable.

Jörg

> Am 09.12.2018 um 17:54 schrieb Dieter <d.gloetzel at web.de>:
> 
> On page 273 of "Programming in Oberon" Wirth and Reiser write:
> 
> FORStatement = "FOR" ident ":=" expression "TO" expression
>                              ["BY" ConstExpression "DO"]
>                               StatementSequence
>                              "END"
> And indeed when I try to put a variable as step size, the compiler doesn't like it.
> 
> This means I cannot write reusable code, which allows to be executed under different conditions with different step sizes.
> 
> I am sure, there is some reasoning behind this, but I find it kind-off inconvenient.
> 
> Regards, Dieter
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list