Q:

If Statement Alternative (Conditional Operator)

I keep getting a syntax error when trying to compile the following:
template <class Type>
Type larger(Type x, Type y)
{
    return (x >= y) ? x : y);
}

I am used to the normal if-else statements but I was trying to get some practice with this format. Any idea where I went wrong?

A:

You have an extra ) at the end of the return statement :
return (x >= y) ? x : y);

should be :
return (x >= y) ? x : y;

