Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array constant problem 1

Status
Not open for further replies.

KempCGDR

Programmer
Jan 10, 2003
445
GB
Hi, I have two array constants defined as:

FULL : Array[1..5] of boolean = (True,True,True,True,True);
NONE : Array[1..5] of boolean = (False,False,False,False,False);

and an array defined as:

Status:Array[1..5] of Boolean;

If I try to compare them with a line such as the one below:

If Status = FULL then {code}

it gives me an error:

'Operator not applicable to this operand type'

I've played around with it a lot and checked the help files with no luck. Can anyone tell me what going on here?
 
I would just code a function to allow the syntax
Code:
  If StatusFULL then {code}
The code to loop thru the Status array would be tucked away inside the function. If the array is part of an object, you could define a property StatusFULL and the function would then be used as the "getter" for the (read-only) property.
 
I would change your arrays to simple strings.

So change your code from

Status[3] := True;

to

Status[3] := '1';

or

Status[3] := IfThen(<BoolExpr>, '1', '0');

then, you'll be able to compare Status to Full.
 
Thanks guys, I took Griffyn's method as it was the easiest to work into the code I already had, and it actually made the code a bit shorter in places :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top