Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Boolean Operators...

Author
Message
TheAbomb12
22
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 18th Nov 2003 19:15
Hey guys,

this may sound silly, but...

I have never been able to get boolean operators to work with DBpro, it never seems to work (perhaps cause im used to C++ )but I got around it by using nested ifs. Anyways, can someone show me the "correct" way to do boolean in DBpro.

thx

Amist the Blue Skies...
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 18th Nov 2003 19:18
If a=1
if b=2
print "a and b both are true"
endif
endif

would be,

If a=1 and b=2
print "a and b both are true"
endif

Kevin Picone
Play Basic - Visible Worlds - Kyruss II
[url]www.underwaredesign.com[/url]
TheAbomb12
22
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 18th Nov 2003 20:53 Edited at: 18th Nov 2003 20:53
what about "or" and exclusive or? i take it that or is the same

also if I said


would that be considered a false statement because a is 0?

Amist the Blue Skies...
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 18th Nov 2003 21:10 Edited at: 18th Nov 2003 21:11
Yep, or and xor are the same type of thing. That code will only print "Hello World" if both a and b equal 1.

EDIT

xor isn't recognised by the copiler. This is a bug that will be fixed.

Do you bite your thumb at me sir?

Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM
qwe
22
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 21st Nov 2003 14:17
you can use ('s also

if (a=1 or b=1) and (c=1 or d=1) then print "true"

if either a or b is one and also c or d is one then its true

Login to post a reply

Server time is: 2026-07-26 15:31:13
Your offset time is: 2026-07-26 15:31:13