• Welcome to Jose's Read Only Forum 2023.
 

Equivalent of PB IsFalse operator

Started by Chris Chancellor, November 30, 2018, 01:01:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chris Chancellor

Hello Charles

do you have a macro that can do a similar function as the PB's  IsFalse operator ?

please refer to https://forum.powerbasic.com/forum/announcements-articles-and-support-faqs/pbwin-online-help-and-commentary/57595-isfalse-and-istrue-operators

i tried to replace it with NOT  and was not sucessful?




Brian Alvarez

Did you try encapsulating the value?

IF NOT (Statement + Statement) THEN

END IF

Charles Pegge

You can directly substitute IsFalse with not :)

if not a=b then ...

Patrice Terrier

The use of PB's IsFalse / IsTrue is a waste of time.

Zero is Always FALSE, while any other value is TRUE.
The NOT operator convert ZERO to -1, while NOT -1 = ZERO.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

#4
In o2, the conditional not is a boolean rather than a bitwise operator. It inverts the logic of any expression that follows it. The grammar is imperfect but it supports very concise conditionals:


int a
if a
  ...
endif

if not a
  ...
endif


translates to:


'if
cmp a,0
jz  fwd _end_cnd
...
._end_cnd

'if not
cmp a,0
jnz  fwd _end_cnd
...
._end_cnd

Chris Chancellor

Thanxx a lot Charles

It makes more sense to use O2 than the ancient PB