switch: looking at one variable
The switch construct offers an alternative to nested if statements. Switch can be used when the test invloves a single variable with a small number of possible values.
The syntax is:
case value: statement; statement; statement; break;
case value: statement; statement; break;
case value: statement; break;
When a match is found, every statement is executed until there is a break.
Please study the material at each of the links below.
Like us on Facebook:
OER: Open Educational Resource
- Calulate tip based on service:Y or N
- Print season from month
Author: Janet E. Joy
; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 23 2017 17:41:26.