IAT 167 Lecture Notes - Lecture 3: Boolean Expression, Collision Detection, Switch Statement

74 views5 pages

Document Summary

Used by conditionals and loops for flow control. Short cut for if-else if-else (nested if-statements) that works on numeric or char values only. Size of dot caries with keyboard interaction (switch statement): Any other key = regular size (0. 75) Execute code multiple times based on certain condition. While() loops: repeatedly executes the code while boolean = true; Combines an arithmetic operation with an assignment operation. ++: adding 1 to a numeric variable. -: deducting 1 from a numeric variable for loops. For ( < initial statement >; < boolean expression >; < final statement >; ) { code in loop. Execution order: initial statement, boolean expression (if true , execute first iteration, final statement, boolean expression loop till boolean = false ; E. g. int sum = 0; for (int i = 0; i<100; i++) { [calculate the sum average of 0-99 in a sum += i; if-else: branching if-else if-else: nested if statement.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents