[fpc-devel] weird syntax

Michael Schnell mschnell at lumino.de
Tue Dec 11 10:04:50 CET 2007


Andrew Haines wrote:
> Hi,
>
>
> Is it possible to make this work:
>
> if X > 3 or < 10 then ...
>
> of course it would be shorthand for: if (X>3) or (X<10) then....
>   
The "or" operator is stronger than the "<" operator by definition. This 
can't be changed.
In C we have a logical or ("||") and a binary or ("|"), as there is no 
boolean type. In Delphi language there is only one operator "or", as the 
type defines the makeup of the operation. While this is nice, it 
prevents the "<" operator from being stronger that "or", as the "or" 
might be bitwise.
> if X > 3 or < -1 or = 4000 or = 1000000 then...
>   
for me
  a  or = 1000000;
should mean a := a or 1000000;

:)


-Michael



More information about the fpc-devel mailing list