aboutsummaryrefslogtreecommitdiff
path: root/docs/notes/if_any.txt
blob: 426aa341c47e6056215436939795795fd133583d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48


// execute all if statements (regardsless of previous outcome),
// and execute "if any" statement if any condition is true.
if a {
   ...
} and if b {
   ...
} and if c {
   ...
} if any {
   ...
}


// normal if-else, but with "if any" statement executed if
// any condition was true (basically, an opposite of else in this case)
if a {
   ...
} else if b {
   ...
} else if c {
   ...
} if any {
   ...
}


// execute "if any" statement if the loop is entered at least once
// (for "for", "while" and "do-while" loops)
while a {
    ...
} if any {
    ...
}

// the opposite of "if any" is usually "else" or "empty", but sometimes "if none".
if a { ... } else if b { ... } else { ... }
while a { ... } empty { ... }
for b in c { ... } empty { ... }
if a { ... } and if b { ... } if none { ... }
// ("if none" might be tricky to implement, due to "none" being an expression
// term also. perhaps it's better to just use "else"?)

// what should happen if "and if" and "else if" are mixed?
// perhaps forbid this? how to implement the check?
// or allow it if the "else if" comes after the "and if(s)"?