User Program Communication

Commenting in Swift

Comments are blocks or lines of text ignored by the compiler, used to provide notes about the code.


Syntax
// Single line comment
/* Block
comment
*/

Notes

Can be used for documentation, code descriptions, resource inclusion, readability, debugging, and any other note that the programmer would like to include.

For the // comment, the compiler will ignore everything from // to the end of the line.

For the /* */ comment, the compiler will ignore anything from /* to */.

Comments can be landmarked with labels like MARK, TODO, and FIXME.


Example
print("I think I am cool") //Outputs the string: I think I am cool!
 
/*Outputs the string:
Because I am
*/
print("Because I am")

< Print   |   Import Module >

© 2019 SyntaxDB. All Rights Reserved.