ENGM 1081 Lecture Notes - Lecture 6: Semicolon, Or Gate, And Gate
ENGM 1081 verified notes
6/29View all
Document Summary
Engm1081- lecture 6 conditional and if else statement. In such a case we use the following conditional statements to out advantage: General case: if(conditional_statement_is_true){ indent with 1 tab here perform commands written here each of these commands have a semi-colon ";" True and false are associated with boolean algebra. Where true represents a 1 and false represents a 0. Example: consider a scenario where x=4 if(x > 3) would return a 1 if(x >= 50. 44) would return a 0. A set of commands occur if the conditional argument receives a value of 1, the commands in the final else automatically execute if the final else has been reached as it represents the only possible scenario left. For multiple associated if"s if(conditional_statement_is_true){ check condition 1. If true, perform commands written here and so on. }else{ when all the above if"s turn out to be false perform commands written here.