Swift language guide (II)-notes and semicolons for language basics

Source: Internet
Author: User

Note

Inject unexecutable text into your code through annotations as your own notes or tips. Notes are ignored when the Swift compiler is running.

Swift comments are very similar to C. A single line comment starts with two backslashes:

// This is a line of comment

Multi-line comments start with/* and end:

/* This is also a comment, but it spans multiple rows */

Different from multi-line comments in C, Swift multi-line comments can be nested in other multi-line comments. Insert another multi-line comment in a multi-line comment block. When the second comment block is closed, the first comment block is followed:

/* This is the beginning of the first multi-line comment/* this is the second multi-line comment nested */This is the end of the first multi-line comment */

Nesting of multi-line comments is a code block that you can more quickly and conveniently comment, even if the code block already contains comments.

 

Semicolon

Unlike other languages, Swift does not require a semicolon (;) at the end of each line of statements. However, when you write multiple statements in the same line, they must be separated by semicolons:

1 let cat = "meow"; println (CAT) 2 3 // output "meow"

 

Thank you, Swifter-QQ group: 362232993 ~

Fork: https://github.com/Joejo/Swift-lesson-for-chinese

 

 

 

 

 

 

 

 

 

 

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.