CS 107 Lecture Notes - Lecture 6: Real Number
Document Summary
*if condition is true print brace block, if not, skip and continue with rest of program. If true do block 1, otherwise do block 2 int n=10; Else if (age ==0) (==) means comparison. Else if (age==1 | | age==2) (| |) means or. Only put it if you want something to happen when all the conditions are false. A truth hunt, followed by a get the heck out of there . Go down the list of conditions, hunting for truth. As soon as you hit a true condition, do only that block of code, and then get the heck out of there by exiting that if structure, and then continue with the rest of the program code. *if a braced block of code has only a single command/statement, then the braces are optional. But lots of programmers always put the braces regardless.