Computer Science 1026A/B Chapter Notes -Grayscale
48 views3 pages
22 Sep 2013
School
Department
Course
Professor
terubarenuka and 39895 others unlocked
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents
Document Summary
{ true execute the statements inside the if statement. False ignore the statements inside the if statement. Test: a boolean with condition(s) that equate to true or false. Body of the statement: when the boolean test result is true, the statements in the body are executed, when it is false, the statements in the body is ignored and execution falls through to the next statement. Brackets: brackets around the statements to be executed if the condition is true are needed when there is more than one statement. However, it is safer to always use brackets even for a single statement in the body, and to line up the brackets for readability. { true execute the statements under the if statement. { false execute the statements under the else statement. If the condition is true, statements under the if statement is executed. Otherwise (in this case since there are no else if statements), execute the statements under the else statement.