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 / What does that mean?

Author
Message
Gunslinger
19
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 6th Sep 2012 15:20 Edited at: 6th Sep 2012 15:22
Hello,
found that in another file:


what does that "<>" mean?
Bigger or Lower? But it's checking it on a string, so how can it be bigger or lower?

Can somebody explain that to me? Thanks.
(I'm converting this file to c++, that's why i'm asking)
Or is that the DB Operator for "IS NOT" ?
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 6th Sep 2012 15:36
hey mate.
<> means not equal.

Gunslinger
19
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 6th Sep 2012 15:44
Ah okay, like i thought. Thanks
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Sep 2012 17:06


TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 6th Sep 2012 19:01 Edited at: 6th Sep 2012 19:02
if a = b //worth

if a > b //a bigger than b
if a => b //a bigger or equal to b

if a < b //a smaller than b
if a <= b //a smaller or equal to b

if a <> b //a not equal

those are the equals u have to remember to use the "IF" function.

in C++ its the same
but instead of <> its != i think.

Advanced Updater for your games!
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 6th Sep 2012 19:07
Quote: "but instead of <> its != i think."

Correct.
And in Lua it's ~=.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Sep 2012 20:51
Quote: "And in Lua it's ~="


You can also use that in C++ As long as the value is boolean it works, because ~ is an inverting bit-wise operator.

TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 6th Sep 2012 21:13 Edited at: 6th Sep 2012 21:18
I would like to give you a little more in-depth answer.

A string is stored as a sequence of bytes in memory. Each character in a string has a code, called its ASCII code (other code sets are available).

When two strings are compared the underlying memory is actually being compared by the CPU on a byte for byte basis, until one string is found to be either greater or lesser than the other. If all bytes are compared then the strings are equal.

Uppercase ASCII

A = 65
B = 66
.
.
.
Z = 90

now, notice that lowercase letters have higher ASCII codes

a = 97
b = 98
.
.
.
z = 122

So, a string can be greater (bigger) than another string, for example

"bANANA" is greater than "ZEBRA"

but

"ZEBRA" is greater than "BANANA"

and

"bANANA" is greater than "BANANA"

"CAR ZERO" is greater than "CAR 1"

"CAR1z" > "CAR1Z"

etc etc

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Sep 2012 22:33
You can't compare them natively with C++ though like this:



I suppose you could overload the operators like here though...



TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 8th Sep 2012 23:48 Edited at: 9th Sep 2012 05:44
Quote: "You can't compare them natively with C++ though like this:"

What are you talking about? I do it all the time, even with constants:


The std::string class already has overloaded operators for almost all the operators.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Sep 2012 01:04 Edited at: 9th Sep 2012 01:04
Quote: "The std::string class already has overloaded operators for the almost all the operators."


The following code doesn't work for me...



TheComet

"Why geeks like computers: unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep." - Unknown
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 9th Sep 2012 01:29
That would be because you're including <string.h> not <string>, I think someone should pay closer attention to the error messages they're getting, I very much doubt that gave you an error about a missing operator

[b]

Login to post a reply

Server time is: 2026-07-08 05:38:54
Your offset time is: 2026-07-08 05:38:54