Goto
This won't work! It just blends together! Please help!
VOID MAIN(VOID)
{
if(&mom<2) goto AST
if(&mom>3) goto BST
{
AST:
blah
BST:
blah
}
}
of course, the blah would be replaced by something.
VOID MAIN(VOID)
{
if(&mom<2) goto AST
if(&mom>3) goto BST
{
AST:
blah
BST:
blah
}
}
of course, the blah would be replaced by something.
because after doing AST it'll just keep going down, to BST, all you have to do is put return; after all the stuff you want at AST:
It is a bit safer to bracket the action of an if. Sometimes stacking the command works, but dink doesn't like it. Also when it does work, if &mom =0, it will goto ast, then continue and run bst too. Above all, when making comparison (using "if"), you must have a space before and after the <= or == or whatever.
hm...
void main ()
{
if (&mom < 2) { goto ast; }
if (&mom > 3) { goto bst; }
}
void separatethis ()
{
ast:
blah
return;
bst:
blahblah
}
you don't need to goto a separate procedure, but you must plan how command will end. And is &mom a global variable? (initiated in "start.c"), if not add int &mom; at the begining of main().
hm...
void main ()
{
if (&mom < 2) { goto ast; }
if (&mom > 3) { goto bst; }
}
void separatethis ()
{
ast:
blah
return;
bst:
blahblah
}
you don't need to goto a separate procedure, but you must plan how command will end. And is &mom a global variable? (initiated in "start.c"), if not add int &mom; at the begining of main().
None of you has done it right (at least not in accordance with documentation).
you can do
if (&one == 1)
say("Wah", 1);
but not
if (&one == 1) say("Wah", 1);
or
if (&one == 1) { say("Wah", 1); }
also notice that you can only have one command if you do it this way, so
if (&one == 1)
say("Wah", 1);
is valid, but
if (&one == 1)
say("Wah", 1);
say("Wah again", 1);
is not. In that case, you must do
if (&one == 1)
{
say("Wah", 1);
say("Wah again", 1);
}
There you go. The really dinky way of doing it.
you can do
if (&one == 1)
say("Wah", 1);
but not
if (&one == 1) say("Wah", 1);
or
if (&one == 1) { say("Wah", 1); }
also notice that you can only have one command if you do it this way, so
if (&one == 1)
say("Wah", 1);
is valid, but
if (&one == 1)
say("Wah", 1);
say("Wah again", 1);
is not. In that case, you must do
if (&one == 1)
{
say("Wah", 1);
say("Wah again", 1);
}
There you go. The really dinky way of doing it.
Now this is weird... In the post I see:
"if (&one == 1) say("Wah",1);
And underneath the reply form I see a return.
It has to be a return, of course, but it's still weird I didn't see it in the original post...
"if (&one == 1) say("Wah",1);
And underneath the reply form I see a return.
It has to be a return, of course, but it's still weird I didn't see it in the original post...
but not
if (&one == 1) say("Wah", 1);
Um... that works. The only thing that you can't do with if statements without curly brackets is variable assignments. For example, this won't work:
if (&gold > 500) &gold -= 500;
And I think this doesn't work too:
if (&gold > 500)
&gold -= 500;
if (&one == 1) say("Wah", 1);
Um... that works. The only thing that you can't do with if statements without curly brackets is variable assignments. For example, this won't work:
if (&gold > 500) &gold -= 500;
And I think this doesn't work too:
if (&gold > 500)
&gold -= 500;