How to know if if/else Statement is true or false

Good day all

How to know if ,if/else statement is true or false. In the example of this corse you use a true statement in the var. in the example of harrypotterfan the code uses a false. How was i to know that.