Forum > Beginners

Error: got "Boolean" expected "LongInt"

(1/1)

Vuudi:
Good evening,

I need some help with my source code over here:

If c > 64 and c < 91 and (c + Frotation > 90)
      or c > 96 and c < 123 and (c + Frotation > 122)
        then c := c - 26;

When I try to compile i get the Error message unit2.pas(55,30) Error: Incompatible types: got "Boolean" expected "LongInt".

Thanks in advance :)


Blaazen:
Brackets.


--- Code: ---If (c > 64) and (c < 91) and ((c + Frotation) > 90)
      or (c > 96) and (c < 123) and ((c + Frotation) > 122)
        then c := c - 26;

--- End code ---

exdatis:
If ((c > 64) and (c < 91) and ((c + Frotation) > 90))
      or ((c > 96) and (c < 123) and ((c + Frotation) > 122))
        then c := c - 26;

or:
If (((c > 64) and (c < 91) and ((c + Frotation) > 90))
      or ((c > 96) and (c < 123) and ((c + Frotation) > 122)))
        then c := c - 26;

p.s. Am I right? Use parentheses to specify priority.

Eugene Loza:
I'd use it in another way:

--- Code: ---case c of
64..91: if (c + Frotation) > 90) then c := c - 26;
96..123: if (c + Frotation) > 122)  then c := c - 26;
end;
--- End code ---
It's not that optimal, but much more readable and understandable as to my taste.

Vuudi:
Thank you guys very much, the brackets work. ;)

Navigation

[0] Message Index

Go to full version