Conditional expression
#1

Is it possible to put that code into conditional expression?

pawn Код:
if(newhealth < oldhealth)
    {
        UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_LIGHTRED, string);
    }
   
    else if(newhealth > oldhealth)
    {
        UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_GREEN, string);
    }
   
    else
    {
        UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK], COLOR_NICK, string);
    }
I think yes.. but it's gonna be a really long conditional..
Reply
#2

I am fairly certain that it already is in a conditional expression; unless my programming vocabulary is off.
Reply
#3

I meant:

pawn Код:
c = (a > b ? b : a);
@down,
That's the thing.. thanks anyway i will have to test it. I got confused while doing that one because it was a really long..
Reply
#4

do you mean ternary operators?
pawn Код:
UpdateDynamic3DTextLabelText(Text3D:PlayerData[playerid][E_PLAYER_NICK],(newhealth<oldhealth)?(COLOR_LIGHTRED):((newhealth>oldhealth)?(COLOR_GREEN):(COLOR_NICK)), string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)