Process Control in C #

Source: Internet
Author: User

Learning Process Control must first understand the flowchart, flowchart is to use some standardized graphics, to visualize a function of the implementation steps, you can make some more complex logic operations become intuitive, easy to understand.

A Process Control statement is an important knowledge in C #, with an If statement that represents a decision, a switch statement that represents the selection, a while statement that represents a loop, a do-while statement, a for statement, and a break statement that represents the end, a continue statement.

Now to say the function of the above statement, if judgment: if the condition 1 is established, then execute Code 1, otherwise determine whether the condition 2 is set up, if it is executed code 2, if none of the above, then execute code n;switch Select: First calculate the value of the variable or expression, Compare the value from top to bottom, and then the value following the case, and when you encounter the same, run the code below it, and then run the code after default, note: Break must be written. The value following the case is a constant, which is compared to the variable or expression following the switch. The double type cannot use this selection statement. While: If the loop condition is true, then the loop body is executed, after execution, then the condition is true, if true, then execution, until the condition is false, only stop; Do while: Perform a loop body first, then determine whether the condition is satisfied, if satisfied, then execute again, and then determine whether the condition is satisfied, Until the condition is not satisfied to end the loop; for: Run expression 1, determine if the loop condition is true, if true, execute the loop body, run the expression 2 after execution, and then judge the loop condition ... The loop will end until the loop condition is false. Finally, the concluding sentence, break: Immediately end the current loop, into the next cycle;

These statements use variables, but also pay attention to the scope of the variable, it means: A variable in the definition of the curly brace, the variable is valid, otherwise invalid. Note: When defining a variable in a location, the variable name must not be the same as the variable name where the scope overrides the location.

Process Control in C #

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.