Member-only story

Commenting in Swift

// Don’t run this line!

Steven Curtis
5 min readMar 28, 2020
Photo by Mika Baumeister on Unsplash

Look, documentation and commenting of code is extremely important. You should be doing it. You should be doing it now.

Not sure how? Read on and find out about single line comments, multiline comments, nested comments and how comments can help you when you option-select your function.

Difficulty: Beginner | Easy | Normal | Challenging

Prerequisites:

  • Be able to produce a “Hello, World!” iOS application (guide HERE)

OR

  • Use Swift Playgrounds to follow with the code (guide HERE)

Terminology

Comments: A way of including text in your code that will not be executed by the compiler

Compiler: A program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer

Documentation: Text (or diagrams) to describe computer code

Forward slash: The / character

Function: A group of statements that together can perform a function

You SHOULD be writing code that isn’t executed…WHAAA

--

--

Responses (1)