Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Quick help #128197
05/05/07 11:19
05/05/07 11:19
Joined: Oct 2006
Posts: 179
ExtraCortex Offline OP
Member
ExtraCortex  Offline OP
Member

Joined: Oct 2006
Posts: 179
How can i check if certain variable is empty?


I tried this but i get an error:

if(variable.x<=>"0"){...

Re: Quick help [Re: ExtraCortex] #128198
05/05/07 11:27
05/05/07 11:27
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline
User
RedPhoenix  Offline
User
R

Joined: Jan 2007
Posts: 651
Germany
???

Just do that:

IF (variable == 0) {

Re: Quick help [Re: RedPhoenix] #128199
05/05/07 11:37
05/05/07 11:37
Joined: Oct 2006
Posts: 179
ExtraCortex Offline OP
Member
ExtraCortex  Offline OP
Member

Joined: Oct 2006
Posts: 179
Quote:

???

Just do that:

IF (variable == 0) {





that way you're telling that the variable must be "0" to do the action.

What i want to tell is 'if variable has any value (it can be zero or any other number) then do that...'

How do i tell that?

Re: Quick help [Re: ExtraCortex] #128200
05/05/07 11:42
05/05/07 11:42
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
if(variable != 0)

now the if block will be executed if the variable is < or > than 0.
0 is no value.

Re: Quick help [Re: Xarthor] #128201
05/05/07 11:47
05/05/07 11:47
Joined: Oct 2006
Posts: 179
ExtraCortex Offline OP
Member
ExtraCortex  Offline OP
Member

Joined: Oct 2006
Posts: 179
Now i have this problem.. When this variable must have the zero value it doest run the action.. lol

That variable must take every real number, < 0 or >.


So then i tried variable!="" but the if runs the action..

Re: Quick help [Re: ExtraCortex] #128202
05/05/07 11:52
05/05/07 11:52
Joined: Mar 2007
Posts: 69
L
luke_was_ere Offline
Junior Member
luke_was_ere  Offline
Junior Member
L

Joined: Mar 2007
Posts: 69
The code:

if(variable != 0)

The "!=" means that if the variable does not equal 0 do something, so it will ignore the 0. what you want is something like this using the OR operator, (not sure if i used the correct syntax for OR but in C++ it is ||:

if (variable <=0) || (variable >0)

{
...
}

Re: Quick help [Re: luke_was_ere] #128203
05/05/07 12:12
05/05/07 12:12
Joined: Oct 2006
Posts: 179
ExtraCortex Offline OP
Member
ExtraCortex  Offline OP
Member

Joined: Oct 2006
Posts: 179
Great! Thanks!
Thanks to you too Thunder.

Re: Quick help [Re: ExtraCortex] #128204
05/05/07 16:18
05/05/07 16:18
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Forgive me if I'm being ignorant, but in this case, whats the point of using in IF statement when you don't care what the expression is?...


xXxGuitar511
- Programmer
Re: Quick help [Re: xXxGuitar511] #128205
05/06/07 17:49
05/06/07 17:49
Joined: Mar 2007
Posts: 69
L
luke_was_ere Offline
Junior Member
luke_was_ere  Offline
Junior Member
L

Joined: Mar 2007
Posts: 69
well how else would you check a variable for a value,


using a While or For statement seems a bit unescessary.

Re: Quick help [Re: luke_was_ere] #128206
05/06/07 17:59
05/06/07 17:59
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
What is he checking for though? He's not doing "if (x == whatever)" he's doing "if (x == anything)"...

A veriable ALWAYS has a value. The default is 0 [zero]. What he's trying to do isn't possible in 3DGS. You can use "ifndef - endif" to see if a DEFINE xxxx has been defined, but not with var's...

That's why I said it was ppointless...


xXxGuitar511
- Programmer
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1