It's probably a typical easy-to-answer beginner question...
The PowerBasic 3.50 reference guide describes the functionality of the ISTRUE operator as follows:
"...ISTRUE ensures that a true expression's value is -1, which isn't guaranteed with other operators."
This means to me that the ISTRUE test must fail when applied on any number/expression that is not equal to -1.
The following test program does not behave as expected:
The output:
What did I misunderstand?
Thanks for your help!
The PowerBasic 3.50 reference guide describes the functionality of the ISTRUE operator as follows:
"...ISTRUE ensures that a true expression's value is -1, which isn't guaranteed with other operators."
This means to me that the ISTRUE test must fail when applied on any number/expression that is not equal to -1.
The following test program does not behave as expected:
Code:
$ERROR ALL ON $DIM ALL DIM A AS INTEGER A% = 100 CLS IF ISTRUE A% THEN 'should only execute if A% = -1 PRINT "A% is TRUE" ELSEIF ISFALSE A% THEN 'should only execute if A% = 0 PRINT "A% is FALSE" ELSE 'should execute if (A% < -1) OR (A% > 0) PRINT "A% is neither TRUE nor FALSE" END IF
Code:
A% is TRUE
What did I misunderstand?
Thanks for your help!
Comment