Ternary operator in a foreach loop
#5

It was all about iterators but never mind. Something similar with a for loop.

pawn Код:
new string[ 40 ];

            for ( new i = 0; i < pData[ playerid ][ e_PLAYER_SEX ] ? sizeof ( male_skins ) : sizeof( female_skins ); i++ ) {
                format(
                    string,
                    sizeof ( string ),
                    "%d\n",
                    pData[ playerid ][ e_PLAYER_SEX ] ? male_skins[ i ] : female_skins[ i ]
                );
            }
Hope it helps anyone who needs something similar.
Reply


Messages In This Thread
Ternary operator in a foreach loop - by Cypress - 12.03.2017, 22:03
Re: Ternary operator in a foreach loop - by ISmokezU - 12.03.2017, 22:21
Re: Ternary operator in a foreach loop - by Cypress - 12.03.2017, 22:24
Re: Ternary operator in a foreach loop - by Unte99 - 12.03.2017, 22:35
Re: Ternary operator in a foreach loop - by Cypress - 12.03.2017, 22:47
Re: Ternary operator in a foreach loop - by Pottus - 12.03.2017, 22:52
Re: Ternary operator in a foreach loop - by Cypress - 12.03.2017, 22:55
Re: Ternary operator in a foreach loop - by Pottus - 12.03.2017, 22:58
Re: Ternary operator in a foreach loop - by Cypress - 12.03.2017, 23:03
Re: Ternary operator in a foreach loop - by Pottus - 12.03.2017, 23:53
Re: Ternary operator in a foreach loop - by Gammix - 13.03.2017, 00:44

Forum Jump:


Users browsing this thread: 1 Guest(s)