Go Flow Control

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

"Go Flow Control"

1. For no (), there must be {}.

  

2. The for before and after expressions can be empty.

  

3, no while,for is the while.

  

4, Infinite cycle.

  

5. If there is no (), there must be {}.

  

6, if temporary variable.

Like for , the if statement can start with a short statement to execute before the condition.

Variables declared by the statement is only in scope until the end of the if .

  

7. If temporary variables can be used in else.

  

8, switch will automatically break.

  

9. The expression in case can be calculated.

  

10, Switch without a condition is the same as switch true .

  

11, delay the execution.

A defer statement defers the execution of a function until the surrounding function returns.

The deferred call ' s arguments was evaluated immediately, but the function call was not executed until the surrounding funct Ion returns.

  

12, Deferred function calls is pushed onto a stack.

  

Output is 9 8 7 6 ...

Reference: HTTPS://TOUR.GOLANG.ORG/FLOWCONTROL/1

Related Article

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.