This section describes how to use C # To select control statements. The third lesson will achieve the following purposes:1. Learn how to use the "if" statement.
2. Learn how to use the "switch" statement.
3. Learn how to use the "break" statement in
1. The so-called programming is to send a command to the computer, using a paragraph, or a few commands to let the computer do what you want it to do.2. The so-called object is the object you want it to do things, just like you want Michael to buy
1.3.4.2 Continue statement
The function of the continue statement is to skip the remaining statements in the loop and enforce the next loop.
The continue statement is used only in a for, while, Do-while, and so on, and is often used in conjunction
Tutorials | control | Statements This section describes how to use C # to select a control statement, and the third lesson will achieve the following objectives:
1. Learn the use of "if" statements.
2. Learn the use of the "switch" statement.
3.
The goto statement is an unconditional transfer statement that is used in the following format:Goto statement label;Where the label is a valid identifier, with a ":" (colon) that appears somewhere inside the function, after the goto statement is
When considering what C + + is doing, Java is doing a good deed, simplifying the issue of how parameters are passed. In C + +, there is no method in C + +, which should be called "function" or "member function", and the parameters and method calls
If you need to execute different established operations for different situations, but you still need to follow the conventional execution process, the task cannot be completed. In this case, you need to introduce the concept of process redirection,
If you need to execute different established operations for different situations, but you still need to follow the conventional execution process, the task cannot be completed. In this case, you need to introduce the concept of process redirection,
Return statementterminates the execution of a function and returns control of the calling function (or control of the operating system if you transfer control from the main function). Resumes execution immediately after the call in the calling
Example 1:
# Include # include int main (void) {char STR [256]; scanf ("% s", STR); If (strlen (STR)
Example 2:
# Include int main (void) {int I = 0; while (1) {I ++; printf ("% d \ n", I ); if (I = 10) goto AAA;} AAA: printf ("OK! \ N ")
Previously seen effect xxx and other books, there will always be this one: avoid using goto statements
The reason is very simple, you a piece of code will jump here, a jump there, jump to the dizzy, like in the maze
It seems to make sense, but in
If for different situations, need to perform different established operations, if or according to the normal execution process, is unable to complete the task, this time, it is necessary to introduce the concept of process jump, using the process
The C language provides a variety of looping statements that can form a variety of different forms of loop structure:
The loop is formed by the Goto statement and the IF statement;
Use the while statement;
Use the Do-while statement;
I. Break 1. break statement format: break; 2. break statement function: A. In A switch statement, break is part of its syntax in this province. The break statement terminates the execution of the subsequent statement and exits the switch
JAVA supports three jump statements:Break, continue, and return. These statements transfer control to other parts of the program. Next we will discuss each statement.
Note: apart from the jump statements discussed here,Java also supports another
Reproduced from-http://blog.programfan.com/article.asp? Id = 9839
The previous article described the Exception Handling Mechanism of Seh, that is, the rules for using the try-try t model. This article continues to discuss another very important
5.3.1 Use the break statement
In Java, the break statement has three functions. First, you can see that in the switch statement, it is used to terminate a statement sequence. Second, it can be used to exit a loop. Third, it can be used as an
If for different situations, need to perform different established operations, if or according to the normal execution process, is unable to complete the task, this time, it is necessary to introduce the concept of process jump, using the process
C # programs execute on a line-by-line, top-down, with no missing code. In order for the program to execute according to the process designed by the developer, it is necessary to make the process of condition judgment, loop and jump, which need to
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.