Debian Codegraph @

examples/book/digital-artists/chapter1/Listing1.15.ck

raw
1 // Listing 1.15 More complex logical conditions
2
3 //conditional statements
4
5 1 => int chance;
6 2 => int chance2;
7
8 if ( (chance == 1) || (chance == 5) ) // Or condition. If chance is equal to 1
9 { // or 5, then the condition is true.
10 //code goes here
11 }
12
13 if ( (chance < 2) && (chance2 >= 6)) // If chance is less than 2, and
14 { // chance2 is greater than or equal
15 //code goes here // to 6, then the condition is true.
16 }