Control Flow Statements Selection by Using Switch and Case

Abdillah, Leon Andretti (2016) Control Flow Statements Selection by Using Switch and Case. [Teaching Resource]

LeonAbdillah_Algoritma_dan_Struktur_Data_08_CFS_SwitchCase 02Genap 2015-2016 20160314.pdf

Download (432kB) | Preview
Official URL:


The if statement allows you to select one of two sections of code to execute based on a boolean value (only two possible values). The switch statement allows you to choose from many statements. Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types, string. An alternative to a series of else if is the switch statement. The switch statement allows you to choose a block of statements to run from a selection of code, based on the return value of an expression. The expression used in the switch statement must return an int or an enumerated value.

Item Type: Teaching Resource
Uncontrolled Keywords: Algorithms, Data Structures, Java, Selection, Switch, Case
Subjects: A General Works > AI Indexes (General)
T Technology > T Technology (General)
Divisions: Faculty of Engineering, Science and Mathematics > School of Electronics and Computer Science
Depositing User: AssocProf. Leon Abdillah
Date Deposited: 23 Jan 2018 10:22
Last Modified: 23 Jan 2018 10:22

Actions (login required)

View Item View Item