If statements have two possibilities, true or false. Code will be executed depending on how the condition is satisfied.

Depending on what the condition evaluates to will cause execution to jump to either the true or false block exclusively. You will NEVER get a situation where both blocks are run.

The diagram above shows the truth situation. If A < B is true then we know A must be the smallest. If A < B is false then B must be smaller. How do we know this? Well it is logic. Take an example if Mr Small is smaller than Mr Big then it goes without saying that Mr Big is bigger than Mr Small! If A < B then B > A.

Why is that important? Simply put we need to be able to decide what goes into our if statements. One way of doing that is using propositional logic. I am not going to go all formal on you and start defining modus yawn rules or anything like that but some of the ideas is very useful to us.

next nested if statements >>

 
Basics
Menu
Search