INSY 3433 Lecture Notes - Lecture 3: Switch Statement, Infinite Loop
Document Summary
Control statement overview: selection statements statements that deal w/ which statements get executed, if/else statements, switch/case statements, repetition statements statements that deal w/ how many times statements execute, for, while, & do while statements. Control statements if/else: the if statement controls whether a statement/set of statements will execute, there is a test condition part of the statement to decide if the statement(s) will execute, ex: if (val > 0) { Control statement if/else: the else statement can pair w/ an if statement & controls whether an alternative statement/group of statements will execute, ex: if (val > 0) { System. out. println( value is 0 or negative ): the else if statement allows for multiple conditions to be checked, ex: if (val > 0) { System. out. println( value is positive ); else if (val == 0) { else { Control statements nested if/else: statement under an if/else can be an if/else, ex: if (val > 0) {