Tim Slattery
6/30/2014 10:05:00 PM
jonas.thornvall@gmail.com wrote:
>Sometimes when i read code i realise my programming skils far to ancient.
>
>return ((N<0) ? "-"+HexN : HexN);
>
>
>This function return is a string but what does ((N<0) ? actually mean
>there is no if. And what about "-"+HexN : HexN);
It's the ternary operator. The first part is delimited by the "?", the
second by the ":". It means: If N is less than zero, return "-"
concatenated to HexN, else return HexN unchanged.
--
Tim Slattery
tim <at> risingdove <dot> com