Logo

Programming-Idioms

History of Idiom 131 > diff from v45 to v46

Edit summary for version 46 by thethanlaw:
[Ada] updating variable names

Version 45

2019-10-01, 15:10:15

Version 46

2019-10-01, 15:10:56

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 a then
    f;
elsif b then
    g;
else
    h;
end if;
Code
if c1 then
    f1;
elsif c2 then
    f2;
elsif c3 then
    f3;
end if;
Comments bubble
assume that f, g, and h are procedure and that a and b are Boolean
Comments bubble
assume that f, g, and h are procedure and that a and b are Boolean