Swift Language Guide (ii) Swift language Basics: Notes and semicolons

Source: Internet
Author: User
Tags comments

Comments

Use annotations to inject executable text into your own code as your own notes or hints. Comments are ignored when the Swift compiler runs.

Swift's comments are very similar to the C language, with Single-line comments beginning with two backslashes:

This is a line of comments

Multiline comment begins with///ends with/*:

<span style= "color: #008000;" >/* This is also a note,  
but across multiple lines * *
</span>

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

Unlike multiline comments in C, Swift's multiline annotations can be nested within other multiline annotations. The writing is to insert another multiline comment within a multiline comment block. When the second comment block is closed, the first comment block is still followed:

/* This is the beginning of the first multiline comment

/* This is the second multiline comment that is nested * *

This is the end of the first multiline comment.

Multiple-line annotation nesting is a quick and easy Comment code block, even if there is already a comment in the code block.

Semicolon

Unlike other languages, Swift does not require semicolons to be used at the end of each line of statements (;), but when you write multiple statements on the same line, you must separate them with semicolons:

1 Let cat = "Meow"; println (CAT)
2
3//Output "Meow"

Author: cnblogs Joe.huang

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.