Check out example codes for "single line if c++". It will help you in understanding the concepts better.

Code Example 1

a = (x > y) ? z : y;

/* Same as */

if (x > y)
{
    a = z;
}
else
{
    a = y;
}

Learn ReactJs, React Native from akashmittal.com