baldtrainer
01-25-2006, 01:46 PM
I'm trying to decipher the meaning in this code. The ? is confusing me.
HighPage = (CurrentCoursePage > HighPage) ? CurrentCoursePage : HighPage;
Any help would be greatly appreciated!
Brandoe85
01-25-2006, 02:22 PM
It's using the ternary operator (google it).
This:
HighPage = (CurrentCoursePage > HighPage) ? CurrentCoursePage : HighPage;
Means:
If the CurrentCoursePage is greater than the HighPage then HighPage = CurrentCoursePage else HighPage = HighPage.
It's a short way of saying:
if(CurrentCoursePage > HighPage)
{
HighPage = CurrentCoursePage;
}
else
{
HighPage = HighPage;
}
Good luck;
could be used also like this:
condition?statement(or function):statement(or function);
and could be used without else{}
condition?statement(or function):null;