Page 1 of 1

goto gosub ??

PostPosted: Sun Mar 08, 2009 9:05 am
by equinox
Hi at ALL,

can be used and if so, some little line of code, please?

(goto....??
(gosub...??

Tnk1000.

Re: goto gosub ??

PostPosted: Sun Mar 08, 2009 9:47 am
by skydereign
I don't know what you mean by gosub... Maybe you mean go[1], kind of thing, but you can't do that. goto works though. And if that is how you want to use it, goto works just the same way, you would just make it so.
Code: Select all
int i;
for (i=0; i<10; i++)
{
    //CreateActor()
}

Using goto,
Code: Select all
int i;
beginning:
//CreateActor();
i++;
if (i<10)
{
    goto beginning:
}
i=0;

Re: goto gosub ??

PostPosted: Sun Mar 08, 2009 2:46 pm
by pyrometal
gosub is not a valid C keyword! The purpose of a gosub statement is really to act as a kind of function abstraction in the languages which do use it. In C, gosub is useless since what it is used for is accomplished by defining custom functions.