no for loop and != in dink c?
is the statement if(&a!=0) and for loops permitted in dink c?
what about the else statement?
what about the else statement?
Read the chapter about "Control Structures" of dinkc.chm.
All usual comparison operators are allowed, just a couple of notes. We also have else-statements.
There must be a space after "if".
There must be spaces around the comparison operator.
Function calls inside the condition are not really allowed. It works for some functions (like "get_sprite_with_this_brain()"), and doesn't for others. I always use a temporary variable.
I have no clue if it accepts 0 and 1 as false/true. I always just use "== 0" and "== 1" and such.
Put "if (condition)" on its own line. Also put "{" and "}" on their own lines.
Put "else" on its own line. Also put "{" and "}" on their own lines.
The only kind of loop you have to make yourself with a combination of goto and if-statements. In short, things can look like this:
All usual comparison operators are allowed, just a couple of notes. We also have else-statements.
There must be a space after "if".
There must be spaces around the comparison operator.
Function calls inside the condition are not really allowed. It works for some functions (like "get_sprite_with_this_brain()"), and doesn't for others. I always use a temporary variable.
I have no clue if it accepts 0 and 1 as false/true. I always just use "== 0" and "== 1" and such.
Put "if (condition)" on its own line. Also put "{" and "}" on their own lines.
Put "else" on its own line. Also put "{" and "}" on their own lines.
The only kind of loop you have to make yourself with a combination of goto and if-statements. In short, things can look like this:
void main( void ) { int &count = 5; } void talk( void ) { freeze(1); loop: if (&count != 0) { say_stop("`%&count bottles of beer!", ¤t_sprite); &count -= 1; goto loop; } else { say_stop("`%Strictly, this else is not needed, but for demonstration purposes...", ¤t_sprite); say_stop("Okay, now you're really not making sense...",1); } unfreeze(1); }
"I have no clue if it accepts 0 and 1 as false/true. I always just use "== 0" and "== 1" and such."
You can do
which is exactly the same as
If that's what you meant?
However I don't think you can do
You can do
if (&var)
which is exactly the same as
if (&var != 0)
If that's what you meant?
However I don't think you can do
if (!&var)