Check out example codes for "conditional operator in cpp". It will help you in understanding the concepts better.

Code Example 1

<condition> ? <true-case-code> : <false-case-code>;

Code Example 2

//(expression 1) ? expression 2 : expression 3
//If expression 1 evaluates to true, then expression 2 is evaluated.
   int x, y = 10;

   x = (y < 10) ? 30 : 40;
   cout << "value of x: " << x << endl; //prints 40

Learn ReactJs, React Native from akashmittal.com