SA-MP Forums Archive
question | loop - 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: question | loop (/showthread.php?tid=84166)



question | loop - RonLipel_ - 29.06.2009

Код:
for(new Game = 0; Game < 2; Game++)
This loop repeating on the numbers 0,1 or just number 1?
cuz by the code its not repeating on 0, so i should change "Game" var to -1?


Re: question | loop - ledzep - 29.06.2009

Integers in PAWN start at 0 unless you set them

Код:
new a;
"a" will equal 0

Код:
new a = 1;
obviously, "a" will equal 1

That being said, your loop will start at 0, even if you didn't initialize "Game" to 0

Your loop will start at 0, and stop 1.
You could test it on your own by printing "Game" each loop.

Код:
for(new Game = 0; Game < 2; Game++)
{
	printf("%d", Game);
}



Re: question | loop - RonLipel_ - 29.06.2009

Quote:
Originally Posted by ledzep
Integers in PAWN start at 0 unless you set them

Код:
new a;
"a" will equal 0

Код:
new a = 1;
obviously, "a" will equal 1

That being said, your loop will start at 0, even if you didn't initialize "Game" to 0

Your loop will start at 0, and stop 1.
You could test it on your own by printing "Game" each loop.

Код:
for(new Game = 0; Game < 2; Game++)
{
	printf("%d", Game);
}
oh, i didn't thought about trying the loop with "print", tnx.