1.9. Comments
We often need to write texts that are not executable programming instructions, just plain text instructions or documentation of our code. These are called comments. In swift, we can write comments in two ways.
For a single-line comment, we use
//.For multiline comments, we use
/* ... */
For example,
// This is a single-line comment before I create a variable...
var str:String = "Nothing"
/* This is a multi-line comment describing the following:
myNum is a Double.
myFloat is a Float.
*/
var myNum = 12.5
var myFloat:Float = 13Last updated
Was this helpful?