# Section 2.2 Conditional Statements.pdf - Section 2.2...

• 13

This preview shows page 1 - 6 out of 13 pages.

Section 2.2 Conditional Statements
What Would We Do Without Conditional? “We like rain if the sun comes after it; we like night if the day comes after it; we like everything conditionally! We are conditional people!” ― Mehmet Murat ildan if (t == LETTER) if ((p=binary(word, keytab, NKEYS)) != NULL) p->keycount++; -- Kernighan and Ritchie, The C Programming Language Fall 2020 (©CAW) Discrete Mathematics 2
Conditional In logic, the conditional, if hypothesis then consequence , if ? then ? , is written formally as ? ? ? is true on the condition that ? is true This seems straightforward But the truth table can be puzzling ? ? ? → ? 𝑇 𝑇 𝑇 𝑇 𝐹 𝐹 𝐹 𝑇 𝑇 𝐹 𝐹 𝑇 The only false in the table is ? true and ? false 𝑇 → 𝑇 Agreed, that should be true 𝑇 → 𝐹 Agreed, that should be false 𝐹 → 𝑇 𝐹 → 𝐹 What about these two? ? is true on the condition that ? is true” says nothing about what to do when
Fall 2020 (©CAW) Discrete Mathematics 3
Both of the following conditionals are true If pigs talk then people walk If pigs talk then people fly We will find this convention very useful later ? ? ? → ? 𝑇 𝑇 𝑇 𝑇 𝐹 𝐹 𝐹 𝑇 𝑇 The only false in the table is when ? is true and is
Fall 2020 (©CAW) Discrete Mathematics 4 𝐹 𝐹 𝑇
Argument with Conditional So far we have argued using the transitive property of