CSC 5750 Lecture Notes - Lecture 17: Switch Statement, Associative Array

20 views7 pages

Document Summary

One statement, curly braces are not required. More than one statement, curly braces are required. A block is a set of one or more statements. An if statement has one or more conditions and one or more execution paths. Conditions are constructed from relational and logical operators. If a condition is true, the block following it is executed. If a condition is false, the if statement either: The switch statement is an limited alternative to the if statement. A switch statement has an expression that is tested against one or more cases. The data type of the expression is typically number or string. If a following else block exists, it is executed. If a following else if condition exists, it is tested. A switch statement may be easier to read when there are more than three conditions to test. A switch statement may have a default case that will run if all other case tests are false.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents