60 likes | 147 Views
CSE115: Introduction to Computer Science I. Dr. Carl Alphonce 219 Bell Hall 645-4739 alphonce@buffalo.edu. Control structures. conditional statements (SELECTION) if-else statement if statement loops (REPETITION) while statement (while loop). Control structure overview if-else statement.
E N D
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 alphonce@buffalo.edu
Control structures • conditional statements (SELECTION) • if-else statement • if statement • loops (REPETITION) • while statement (while loop)
Control structure overviewif-else statement if ( <expr> ) <stmt1> else <stmt2> <expr> false true <stmt2> <stmt1>
Control structure overviewif statement if ( <expr> ) <stmt> <expr> true <stmt> false
Control structure overviewwhile statement while ( <expr> ) <stmt> <expr> true <stmt> false
for loop syntax for ( stmtinitializer ; expression ; stmtupdate ) { body of loop }