elseif phrase
#1

Hi. Can somebody explain how else if{ works?

Here's an example

pawn Код:
else if(PlayerInfo[playerid][pAdmin] >= 1)
Does that mean if LESS THAN 1?

> = Less Than
< = More Than

Equal to = ?
Reply
#2

Operator Meaning Usage
Код:
==	 Left is equal to Right	 if (Left == Right)
!=	 Left is not equal to Right	 if (Left != Right)
>	 Left is greater than Right	 if (Left > Right)
>=	 Left is greater than or equal to Right	 if (Left >= Right)
<	 Left is less than Right	 if (Left < Right)
<=	 Left is less than or equal to Right	 if (Left <= Right)
- From SA-MP Wikipedia.
Reply
#3

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
Operator Meaning Usage
Код:
==	 Left is equal to Right	 if (Left == Right)
!=	 Left is not equal to Right	 if (Left != Right)
>	 Left is greater than Right	 if (Left > Right)
>=	 Left is greater than or equal to Right	 if (Left >= Right)
<	 Left is less than Right	 if (Left < Right)
<=	 Left is less than or equal to Right	 if (Left <= Right)
- From SA-MP Wikipedia.
thx.
Reply
#4

WRONG SECTION, GO BACK
Reply
#5

https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#6

Even if its the wrong section im gonna explain this.

else if always is in connection with another if. So if the first if fails, it will call the else phrase, if it is defined.
With else if you then put another condition into that else phrase, this one is checked then.

pawn Код:
if (b >= 1) {
    // called if b is bigger or equal to 1
} else {
    // called, when b is NOT bigger or equal to 1
}

if (a >= 1) {
    // called if a is bigger or equal to 1
} else if (a < 0) {
    // called if the first check failed, and a is less than 0
}
else if alone without another if wont work, but after the first if, you can add as many else and else if phrases as you like.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)