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 / Relational Operator Question

Author
Message
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 22nd Mar 2003 22:45
Using Laptop with:
DBPro with Patch 4
Windows XP Service Pack 1
DirectX v. 8.1
Mobile Pentium 4 ~1700
256MB Total Physical Memory
Mobility Radeon 7500 AGP (LW), 64MB
Unknown Motherboard
_____________________________________________________

I jest had a quick question about the 'DOES NOT' Relational Operator. I am very familliar with the BASIC programming language general syntax, and was wondering if the symbol "" means does not.

Example:
if variable1 variable2 then gosub _fakesubroutine

In other languages (I am mostly talking about QBASIC, etc.) that was the correct usage.

Thankx
Flux
“I create games only to test my imagination’s limits” - MSB
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Mar 2003 23:04
< > means different to/not equal to (put the two brackets together)
.. means binary NOT

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 22nd Mar 2003 23:12
Ok, but the code example I used was correct?
Oh, and I never used the boolean operators before.

“I create games only to test my imagination’s limits” - MSB
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 23rd Mar 2003 00:35
No, that wouldn't work. You need :

if variable1< >variable2...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 23rd Mar 2003 01:27
doh! I knew that!
Thanks for the help.
I jest wanted to make sure I was doing everything right, because in the help, it did not show anything of using the <> operator.

Flux

“I create games only to test my imagination’s limits” - MSB
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 23rd Mar 2003 01:36
Yes, that is missing...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 23rd Mar 2003 02:03
if variable1 .. variable2 then gosub _fakesubroutine

'..' - NOT
'&&' - AND
'||' - OR
"~~" - XOR

if you use <> then all your really doing is faking the effect

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 23rd Mar 2003 03:18
Ok, when you are saying faking, does that mean that <> will still work, or do
I have to use the '..' operator?

“I create games only to test my imagination’s limits” - MSB
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 23rd Mar 2003 11:46 Edited at: 23rd Mar 2003 11:47
<> is used for comparing two variables
.. is used to binary NOT a variable - you may not get the result you require if you use the wrong command at the wrong time.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Mar 2003 03:17
yeah i suppose... could just throw bin( ) around the values just to be safe, but then again the <> compare would do the same wouldn't it

because all its doing is making sure Value1 isn't < or > Value2
so as long as Value1 is NOT Value2 were all happy
lol ahh for the simple refines of having the whole array of operators at our disposal

try both Flux, see which one works better - personally i go with the binary operators as they're more presise, but i guess if there are still kinks in the code for them they may produce unwanted results
could always just use the word NOT ... they've added that now haven't they?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 24th Mar 2003 10:57
And watch out for comparing BYTE variables - it tends not to work...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 24th Mar 2003 16:49
Ahhh bitwise logical operation... Always gave me a headache lol

Always seemed to me that every bitwise logical relation does the same thing...

1 and 1 = 1
1 and 0 = 0
0 and 1 = 0
0 and 0 = 0

Never understood the need to do that so many different ways 8)

There I go being an advanced newbie again...

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Mar 2003 17:22
lol... why do i get the feeling were working around something that shouldn't be a bug (^_^)

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 24th Mar 2003 22:38
Well, now you all have gotten me a bit confused, I think...or maybe not. :-s All I want to do is make sure that variable A is not the same as variable B.

Oh, and I have never used the bitwise logical operators. Never quite understood them, but then again, maybe their concept is very simple.
Put it this way...I will know if my way works or not when I run my Retro program the first time this Thursday (I gave myself a completion date)

Happy Coding,

Flux

“I create games only to test my imagination’s limits” - MSB
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 25th Mar 2003 00:17
oki make it all simpler

if value1 not value2 then gosub SomethingHappens
or
if value1 .. value2 then gosub SomethingHappens
of
if value1 <> value2 then gosub SomethingHappens

now i think its quite likely if the engine still isn't accessing binaries or booleans properly yet then the '..' will most likely be a hit and miss unless you use the 'bin( )' function and the '<>' is really not an actual operator as such because all it is doing is comparing making sure the value is nither greater than AND less than the current value ... i mean same result, but it can also be a little unpredicatable.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th Mar 2003 00:25
You cant do :

if value1 not value2 then gosub SomethingHappens

NOT is a unary operator...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 25th Mar 2003 02:17
hmm... thats kinda annoying somedays wish they'd add C/C++'s style of operators



i mean that is alot simpler (^_^) even the extra inclusions are



which would the the same as



don't ya just love these operators hehee

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
DARKGirl
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Right behind you....
Posted: 25th Mar 2003 08:00
Yea, I love them when they are not driving me crazy...oh and what do you mean that the <> operator can be unpredictible? Also, you do mean 'NOR' when you said, "...making sure the value is nither greater than (AND?) less than the current value ... i mean same result..."

Flux

“I create games only to test my imagination’s limits” - MSB
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 25th Mar 2003 17:11
probably would've made more sense with OR hehee
but you got what i ment

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 27th Mar 2003 00:02
What ever happened to

IF value1 != value2 THEN GOSUB somethinghappens

lol I miss the ol' reliable "Not equal to" operator... Very simple and predictable to use

MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Mar 2003 00:56
I find <> very simple and predictable to use...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 27th Mar 2003 06:16
Raven originally said:
Quote: "'..' - NOT
'&&' - AND
'||' - OR
"~~" - XOR"


Or you could just be lazy like me and not use these operators I just use AND and OR. Then of course <, >, =, <>, etc.

Login to post a reply

Server time is: 2026-07-12 00:27:21
Your offset time is: 2026-07-12 00:27:21