In the line
temp = temp- (temp >150 ? 100 : 20 );
what does the '?' stand for? I know it's got to be doing something there. I just don't know what.
In the line
temp = temp- (temp >150 ? 100 : 20 );
what does the '?' stand for? I know it's got to be doing something there. I just don't know what.
Its part of the ternary operator. Its goes something like this:
(testcondition) ? ThisHappensIfTrue : ThisHappensIfFalse ;
So in your example:
>>temp = temp- (temp >150 ? 100 : 20 );
if temp is greater than 150, the calculation is
>temp - 100
else its
>temp - 20
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>>Its part of the tenary operator<<
otherwise known as the conditional operator.