Jose's Read Only Forum 2023

IT-Consultant: Charles Pegge => OxygenBasic => Topic started by: Chris Chancellor on November 30, 2018, 01:01:43 AM

Title: Equivalent of PB IsFalse operator
Post by: Chris Chancellor on November 30, 2018, 01:01:43 AM
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 (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?



Title: Re: Equivalent of PB IsFalse operator
Post by: Brian Alvarez on November 30, 2018, 01:13:02 AM
Did you try encapsulating the value?

IF NOT (Statement + Statement) THEN

END IF
Title: Re: Equivalent of PB IsFalse operator
Post by: Charles Pegge on November 30, 2018, 12:32:38 PM
You can directly substitute IsFalse with not :)

if not a=b then ...
Title: Re: Equivalent of PB IsFalse operator
Post by: Patrice Terrier on November 30, 2018, 03:00:09 PM
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.
Title: Re: Equivalent of PB IsFalse operator
Post by: Charles Pegge on December 03, 2018, 01:10:36 PM
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
Title: Re: Equivalent of PB IsFalse operator
Post by: Chris Chancellor on December 03, 2018, 02:07:22 PM
Thanxx a lot Charles

It makes more sense to use O2 than the ancient PB