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

Dieter d.gloetzel at web.de
Sun Dec 9 17:54:56 CET 2018


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



More information about the Oberon mailing list