question | loop
#1

Код:
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?
Reply
#2

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);
}
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)