sorry for the newbie question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: sorry for the newbie question (
/showthread.php?tid=67984)
sorry for the newbie question -
Badger(new) - 06.03.2009
sorry, but i've searched on these forums and sa-mp wiki (just incase) for info on what
is and does.
Re: sorry for the newbie question -
[RP]Rav - 06.03.2009
it does exactly what it says
Код:
while (expression is true)
{
// you can do something here
}
like for example
pawn Код:
new i = 0;
while (i < 5)
{
printf("%d",i);
i++;
}
Re: sorry for the newbie question -
Freestyler - 06.03.2009
meh...
Re: sorry for the newbie question -
1337pr0 - 06.03.2009
Quote:
Originally Posted by Rav
it does exactly what it says
Код:
while (expression is true)
{
// you can do something here
}
like for example
pawn Код:
new i = 0; while (i < 5) { printf("%d",i); i++; }
|
Yes, what he said. Another example:
pawn Код:
new i = 0;
new e = 0;
while(!i)
{
if (e > 5)
{
i = 1;
}
e++;
}
This will also break the while() when e is above 5, because i becomes 1 (true).
Quote:
Originally Posted by Freestyler
meh...
|
You like your post count, don't you?
Re: sorry for the newbie question -
Nimphious - 06.03.2009
What can while be used for?
Re: sorry for the newbie question -
MenaceX^ - 06.03.2009
Quote:
Originally Posted by [FF
Nimphious ]
What can while be used for?
|
It's a joke right?
Re: sorry for the newbie question -
Norn - 06.03.2009
Why isn't this used more? I rarely see it in any released scripts.
Re: sorry for the newbie question -
Badger(new) - 06.03.2009
ohh. so does it just mean during the stuff in the () and then you have the {and }.
Re: sorry for the newbie question -
Nimphious - 06.03.2009
Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by [FF
Nimphious ]
What can while be used for?
|
It's a joke right?
|
No. I have never seen (while) before and was just wondering what it could be used for.
Quote:
Originally Posted by iTails
Quote:
Originally Posted by [FF
Nimphious ]
What can while be used for?
|
Step away from the keyboard please.
Basically, you can do something, while doing something else. Common sense.
|
oic. thnx,
Re: sorry for the newbie question -
kc - 06.03.2009
Quote:
Originally Posted by Norn
Why isn't this used more? I rarely see it in any released scripts.
|
because for most things a for loop will do the same job with less effort to the scripter.