Sequence of conditions

Sometimes we need to do a sequnce of conditions before we decide what actions our program will execute. In such cases, we can apply the construct if-else if ... -else in serie. For this purpose we use the following format:

if (condition)
{
    // condition body;
}
else if (second condition)
{
    // condition body;
}
else if (third condition)
{
    // condition body;
}
…
else
{
    // else construction body;
}

results matching ""

    No results matching ""