elseif phrase - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: elseif phrase (
/showthread.php?tid=484493)
elseif phrase -
Jing_Chan - 31.12.2013
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 = ?
Re: elseif phrase - Patrick - 31.12.2013
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.
Re: elseif phrase -
Jing_Chan - 31.12.2013
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.
Re: elseif phrase -
ev0lution - 31.12.2013
WRONG SECTION, GO BACK
Re: elseif phrase -
Mattakil - 31.12.2013
https://sampwiki.blast.hk/wiki/Control_Structures
Re: elseif phrase -
Mauzen - 31.12.2013
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.