Skip to content
Justice Tech School

Comments

// is a line comment and /* */ a block that can nest. /// writes documentation.

Example
// line
/* block /* nested */ */
/// Adds two numbers.
func add(_ a: Int, _ b: Int) -> Int { a + b }
print(add(1, 2))

Exercise

Doc comment.

 Adds two numbers

Quiz Test

Can block comments nest?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.