• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ternary Operator Basics
#2
Good tutorial, you just forgot to mention that ternary operator supports multiple conditions.
For example:
PHP Code:
SendClientMessage(playerid, -1, playerData[playerid][pAdmin] == 1 ? "Admin lvl 1" : playerData[playerid][pAdmin] == 2 ? "Admin lvl 2" : playerData[playerid][pAdmin] == 3 ? "Admin lvl 3" : "Admin lvl 4");

And btw, you don't need brackets, just own preference.
EDIT: You need brackets if you aren't using the community compiler, found out a few days ago..
  Reply


Messages In This Thread
Ternary Operator Basics - by RhaegarX - 2021-01-20, 07:29 PM
RE: Ternary Operator Basics - by Shadow - 2021-04-28, 07:58 AM
RE: Ternary Operator Basics - by RhaegarX - 2021-04-30, 12:22 AM
RE: Ternary Operator Basics - by kemper - 2021-04-30, 06:11 PM
RE: Ternary Operator Basics - by Shadow - 2021-05-03, 02:40 PM