Control Flow Statement

Source: Internet
Author: User

Condition Statement If () {} Else {} If condition statements can be nested Loop statement For (initialization; terminate loop condition expression; increment) {} For Loop conditions are optional and can be default, but ";" cannot be default. Nesting can be performed multiple times. When the while (condition) {} condition is true, the execution cycle body is false and the loop is exited. You can nest for and while multiple times to check the loop conditions in the header. If the condition is not true, you can exit without executing any loop. Do {} while (condition) executes the loop body first. When the judgment condition is true, the statement is executed. If the condition is false, the loop is exited. Execute at least one loop body. Switch statement Switch (variable ){ Case Constant 1: Case Constant 2: Default : } The variables in the switch are numeric values and the case and default statements in the switch can be cyclic bodies, and {} break can be used in cyclic statements and switch statements, jump out of the previous loop body and switch statement and execute the following statement. Continue: Used in loop statements. It skips the remaining statements in the loop body and forcibly enters the next loop. Goto: unconditional transfer statement. No.

 

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.