Tag Archives: comments

Comments in SWIFT and markups

When you start programing in a new language then writing a comment into code is probably not what you want to learn in the fist few hours. Booooring one could say. Yes comments are not sexy when you have to write them but it is extremely NICE if you have them once the program is some months old and you want to modify something. I tell you… I programmed without comments in my first few Visual Basic programs and it took me longer to understand what I did then, than to probably code it in the first place.

So comments not sexy but extremely useful later on.

We learned how nice comments are, or maybe you have to learn it the hard way like I did, and now I quickly tell you the way to write them in SWIFT

With “//” you start a single line comment.

/ This is a single line comment in SWIFT
With “/*” you start a multi line comment and you end it with “*/”
/* This is a comment that you write over
more than one line */
If you really love comments and you want to document your code properly, then you should use the markup language that is provided to show well structured comments in the quick help section. It also shows comments when you ⌥ + “click” on a function.

It would take far too long to repeat everything that can be written about the mark up language so I enter the link here to apples reference document for markups.

link to the Apple markup reference