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.

Example:
————————————–
/ This is a single line comment in SWIFT
—————————————
With “/*” you start a multi line comment and you end it with “*/”
Example:
—————————————-
/* 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

Programing in SWIFT

When I got my first PC I taught myself to code a bit in Basic. I only played with some small programs and ended in programming a poor adventure game (one like in the early times where you had to type what the character was supposed to do).
Then ages ago in 1996 I had to code in “Turbo Pascal” at school. It was a engineering focussed school, so it was all about sorting algorithms and in the end also a small control program to adjust a satellite dish to the angle and direction in a test. Somehow I lost interest in coding then.

I did not code anymore and only two years ago I started to code in “Visual Basic for Excel” as it helps me a lot in my tasks at work.

Coding now came back to my attention and I thought to myself whether I should learn to code again. Not Visual Basic, but a real programming language.

It was the time of Apple announcing SWIFT in 2014 and I was struggling to decide to learn C++ or SWIFT.

After a lot of pro and con arguments for each programing language I decided to go for SWIFT. I simply feel as if it is the language to learn at the moment. It will get very popular for all mobile platforms and maybe even one day relevant for the gaming or business software industry.
I have not ambition to get a professional coder or software engineer, but I love to be able to code and understand the concepts and what happens in all these small programs that you can by in app stores and maybe even one day program one by myself.
I’ll be posting my progress and some articles about the language…

My intention for me is also to have my own coding reference where I can look up things that I already did once before, but maybe forgot about.