Chapter 4
Code Comments
You use code comments when you want to add information to your code. With Swift, you can add a one-line code comment, multiple-line code comments, and even nested code comments.
One-Line Code Comments
Use the double backslashes (//) to start a one-line code comment. See Listing 4-1 as an example.
Listing 4-1. One-Line Code Comment
//One line code comment
You can fill up one line with these types of comments.
Multiline Comments
One-line comments are fine for quick notes about code that may need some extra information provided. But when you want to add a lengthier description, you can write over many lines at once. To write a multiline comment, you start the comment with a backslash and asterisk (/*), write the comment, ...
Get Swift Quick Syntax Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.