dinkc question
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.
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
--WC
: 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.
}
: --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.
}
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::
: 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:
another way:
if (&thing < 1)
goto whatever;
if (&thing > 3)
goto whatever;
do this
whatever:
Aww p**s, I meant nested if() statements..
--WC
--WC
: 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
}
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
}