Swift Comments
In this tutorial, we shall learn about Swift Comments with examples.
Swift Comments help to improve the readability of the program.
Comments do not have any effect on the program execution. They are ignored by the compiler.
You can write two types of comments in Swift programs.
- Single line comments
- Multiple line comments
Swift single line comments
To write a single line comment in swift, you can use double slash //
at the start of a line
</>
Copy
// This is a comment in Swift program
or you can include the line in /* */
pair.
</>
Copy
/* This is a comment in Swift program */
Swift multiple line comments
To write a multiple line comment in swift, you can use double slash //
at the start of line
</>
Copy
/* This is a line in the comment
This is another comment line */
Conclusion
In this Swift Tutorial, we have learned how to write single and multiple line comments in Swift programming.