as title, I get a compile error when I use the mod operator in constant
expressions.
eg, with this program ...
program pmod (Output);
const
c = 9 mod 5; { <<<< error }
begin
WriteLn ('9 mod 5 is ', c);
end. { pmod }
pmod.pas:3: error: constant has non-constant value
I can rewrite the constant as
c = 9 - 5*(9 div 5); { this is equivalent to 9 mod 5 }
without problems.
This seems strange to me - am I missing something?
What makes it a non-constant?
Many Thanks