Java programming those things 34 -- switch statement syntax Zhengzhou game college Chen yuefeng from: http://blog.csdn.net/mailbomb
5.3.2 switch statementThe Chinese meaning of the switch keyword is the meaning of switch and conversion. The switch
With the increasing popularity of Mbit/s, Gbit/s, and even Mbit/s local area networks, broadband MAN networks and even broadband wide area networks are widely used. Whether it is Intranet, exclusive, or residential intelligent networks, it is
RELATED Links:
PHP Syntax (i): Foundations and variables
PHP Syntax (b): Data types, operators, and functions
PHP Syntax (iii): Control structure (for loop/if/switch/while)
This article I will summarize a few PHP commonly used control structure,
: This article mainly introduces PHP syntax 3: control structure For loop IfSwitchWhile. if you are interested in PHP tutorials, refer to it.
Related links:
PHP syntax(1): Basics and variables
PHP syntax(2): data types, operators, and functions
PHP
Objective
Process Control statement:
In the process of executing a program, the order of execution of each statement has a direct effect on the result of the program. That is to say, the process of the program has a direct impact on the running
The switch statement is also the longest common logical control statement in object-oriented programming statements. The Switch statement is used to perform different actions based on multiple different conditions-that is, when the conditions are
1 /*Switch Statement2 format:3 switch (expression)4 {5 Case takes value 1:6 execute the statement;7 Break ;8 Case takes value 2:9 execute the statement;Ten Break ; One ..... A Default: - execute the statement; - Break ; the } - - */
switch ( expression ) The data type of the value of the selected expression can only be a byte short int char{case takes value 1: execute the statement;break; case takes value 2: execute the statement;break; ..... ...Default:execute the
The first time I saw this switch-case syntax, I wrote a small test program in Linux source code.# Include
Int main (){Int Nr = rand () %128;Int * idx = & NR;Switch (NR ){Case 1: * idx = 0; break;Case 2 4: * idx = 1; break;Case 5 16: * idx = 2;
Switch is used in programming. For example, it is often used together with case in C language.Code. Its function is to control the flow of business processes.The syntax of the switch statement is as follows (switch, case, and default are keywords
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.