Comments in Swift

Swift Programming Language By Knownion

Single Line Comments In Swift

Comments are used in programs to make them clearly understandable. They are like helping texts in programs and ignored by compiler. In Swift, single line comments are written using // at the beginning of the comment.

//This is the single line comment

Multiple Line Comments In Swift

Comments are those lines in Swift program which do not get compiled by the Swift compiler at the time of compilation. They act as helping texts for programmers to understand the working of the code snippet and are ignored by the compiler. Multiline comments start with /* and terminate with */ and in between the strings that will act as a comment.

import UIKit
/* This is the comment section */
var str = "Hello Knownion"
/* This is another comment :: end of code */

Post a Comment