what is a >?= b

where a and b are variables.
I don’t understand this operator… i’ve seen it in a solution… what does it do?
and how to use it?

If a>b,then it will return a,else it will return b,i.e it will return maximum of a and b;
This is similar to expression a>b?a:b

For finding maximum of 2 numbers

    //function to find maximum of 2 numbers

    int maximum(int a,int b)
    return  a>b?a:b
1 Like

thank you :slight_smile:

welcome :slight_smile:
You can mark this as correct answer :slight_smile:

if a>b, it will return a if a is greater else it will return b… similarly if a>b?a:b will return a if a is greater than b else b…
in simple words…

if condition 1>condition 2 or if condition 1>condition 2? condition 1:condition 2

will return condition 1 only if it is true else it will return condition 2…

1 Like