Logo

Programming-Idioms

History of Idiom 131 > diff from v36 to v37

Edit summary for version 37 by arouene:
New Cpp implementation by user [arouene]

Version 36

2019-09-26, 18:08:07

Version 37

2019-09-26, 18:10:44

Idiom #131 Successive conditions

Execute f1 if condition c1 is true, or else f2 if condition c2 is true, or else f3 if condition c3 is true.
Don't evaluate a condition when a previous condition was true.

Idiom #131 Successive conditions

Execute f1 if condition c1 is true, or else f2 if condition c2 is true, or else f3 if condition c3 is true.
Don't evaluate a condition when a previous condition was true.

Extra Keywords
else switch case
Extra Keywords
else switch case
Code
if (c1)
{
    f1();
}
else if (c2)
{
    f2();
}
else if (c3)
{
    f3();
}