utopiomania wrote:#TRUE is a constant defined as NOT #FALSE. True can be anything as long as it is not false, and false
can be anything as long as it is not true.
I was just thinking about this the other day while working on an IF structure. I have to agree with Mr. Gaman's original question. #False is always false it never changes. But #True is not always "true" but never false. This is what I came up with. I wonder if it will work in every case? Thanks to Idle for the tip!
Macro IsTrue(v)
v Or 0
EndMacro
Macro IsFalse(v)
0 Not v
EndMacro
Test = 0
If IsTrue(Test)
Debug "test is true"
EndIf
If IsFalse(Test)
Debug "test is false"
EndIf
Jack
Make everything as simple as possible, but not simpler. ~Albert Einstein
Test = 0
If Test
Debug "test is true"
EndIf
If Not Test
Debug "test is false"
EndIf
Because pointless coding gymnastics force me to think about things I normally would not think about. Also because it helps a PureBasic noob like me gain a deeper understanding of the language. Other than that it's a good question and interesting to read everyone's reponses and code.
Jack
Make everything as simple as possible, but not simpler. ~Albert Einstein