Logo

Programming-Idioms

History of Idiom 131 > diff from v51 to v52

Edit summary for version 52 by boukeversteegh:
New Dart implementation by user [boukeversteegh]

Version 51

2020-07-18, 21:50:58

Version 52

2020-09-08, 15:25:40

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.

Variables
f1,c1,f2,c2,f3,c3
Variables
f1,c1,f2,c2,f3,c3
Extra Keywords
else switch case
Extra Keywords
else switch case
Code
if (c1) {
  f1;
} else if (c2) {
  f2;
} else if (c3) {
  f3;
}
Doc URL
https://dart.dev/guides/language/language-tour#if-and-else