Golang and C # switch differences

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Golang and C # switch differences


Go is a compiled, parallelized and garbage-collected programming language developed by Google.

C # is an object-oriented, high-level programming language running on the. NET framework that Microsoft publishes.

Although the main use of the development process is not C #, but the development process will inevitably read the C # code, the following is the comparison of the two domain name switch

Switch for 1.Go:


Output:


Switch of 2.c#


Output:


In summary, each key in go corresponds to a case, there is no corresponding case, then the default is executed, there is no default this does not execute code, in the same case statement, you can separate the different conditions with commas; in C #, Control cannot be run from one case label to another, and the end-use label must not have a Break,key counterpart, and if no code is executed, it will be deferred until the end of the break.

Wxgzh:ludong86


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.