What is this syntax?

Came accross this syntax, never seen it before. What does it do?

double fakeFunction(double x1, double x2){
   return(x1 < x2) ? x2 : x1;
}

Thanks :)
LVL 11
bingieAsked:
Who is Participating?
 
BenMorelConnect With a Mentor Commented:
This is exactly the same behavior as :

double fakeFunction(double x1, double x2) {
 if (x1 < x2) return x2;
 else return x1;
}

this is a max() function ;)
0
All Courses

From novice to tech pro — start learning today.