if statement / condition
#1

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 }
Reply
#2

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
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)