SA-MP Forums Archive
if statement / condition - 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)
+--- Thread: if statement / condition (/showthread.php?tid=401976)



if statement / condition - thefatshizms - 24.12.2012

Hello, I'm just wondering what this actully means?

pawn Код:
if(somecondition)
{
//code
}
//or
while(somecondition)
{
//code
}
Where there is no || && etc its just blank
for example
pawn Код:
while(Checkpoint[id]) { //code }



Re: if statement / condition - Typhome - 24.12.2012

Quote:

while is a loop type similar to for and do..while. The basic operation is an if statement done which if true does some code and jumps back to the if. If it's false it goes to after the loop code - there is no else. Going back to the goto example:

Код:
new
	i = 0;
for_loop:
if (i < 10)
{
	i++;
	goto for_loop;
}
This can also be written as:

Код:
new
	i = 0;
while (i < 10)
{
	i++;
}
Have look at -> https://sampwiki.blast.hk/wiki/While#while


Re: if statement / condition - Konstantinos - 24.12.2012

It means if it's true.
pawn Код:
if(somecondition)
{
    //somecondition returns true;
}
pawn Код:
if(!somecondition)
{
    //somecondition returns false;
}



Re: if statement / condition - thefatshizms - 24.12.2012

EDIT: ahh thanks guy above me wasn't that sure when i saw this
pawn Код:
while(ID < sizeof (Pickups) && Pickups[ID])