The Dink Network

dinkc question

August 7th 2002, 04:14 PM
death.gif
hi, yet another question about dinkc that I couldn't find an answer to in tutorials. Simply, is there any way to 'stack' the booleans in if statements? (like using && or || in C++) sorta like you can in for choice statements.
August 7th 2002, 04:45 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Nope, you would have to use nested loops (I assume you know what the means due to it looks like you've had some programming experience).

--WC
August 7th 2002, 06:14 PM
wizardg.gif
Paul
Peasant He/Him United States
 
: Nope, you would have to use nested loops (I assume you know what the means due to it looks like you've had some programming experience).

: --WC

What do you mean nested loops? I thought they asked about ifs.

WC's right though, you one comparison per if only.

For AND you use nested ifs, for OR you can use either two seperate ifs or set a flag like this:

&flag = 0;

if (&a == 1)

&flag = 1;

if (&b = 1)

&flag = 1;

if (&flag = 1)

{

//do stuff.

}
August 7th 2002, 08:08 PM
death.gif
Yea, I was pretty sure...just trying to see if I could delay the inevitable. It's just that Dinkc is a little weird about nested ifs...it tends to execute things inside false statements if the inner if comes out true...::grumble::
August 7th 2002, 09:43 PM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
: Yea, I was pretty sure...just trying to see if I could delay the inevitable. It's just that Dinkc is a little weird about nested ifs...it tends to execute things inside false statements if the inner if comes out true...::grumble::

another way:

if (&thing < 1)

goto whatever;

if (&thing > 3)

goto whatever;

do this

whatever:
August 7th 2002, 10:13 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Aww p**s, I meant nested if() statements..

--WC
August 9th 2002, 09:46 AM
wizardg.gif
Paul
Peasant He/Him United States
 
: Yea, I was pretty sure...just trying to see if I could delay the inevitable. It's just that Dinkc is a little weird about nested ifs...it tends to execute things inside false statements if the inner if comes out true...::grumble::

I haven't had too much trouble with that. Make sure you use lot's of {}s though. Fot example this is valid in C, but not DinkC:

if (a == 1)

if (b == 1)

//do something

In DinkC you have to write:

if (&a == 1)

{

if (&b == 1)

//do something

}