mod operator in constants not allowed
17 Oct
2014
17 Oct
'14
2:57 p.m.
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
4345
Age (days ago)
4345
Last active (days ago)
2 comments
2 participants
participants (2)
-
Maurice Lombardi -
trevor