Chapter 5 : Constants



Types of Comments



A constant is a variable whose value can be assigned only once.

What is a Constant


Constants are defined with a keyword let. If you know that the value of a variable will not change it should be declared as a constant.












Constants Names :

You can assign any Unicode name to variable/constant names, this is not possible in many other porgramming languages. So you can use names from almost any language like German, Hindi, Chinese, Japanese e.t.c. You can even have a Smiley as a constant/variable name.

Note that you cannot use arithmetic operators like + , - , * , % in a variable name, nor can the names start with a numeric value.

You can even define a variable name to a keyword that exists in Swift, just surround the name with back ticks (`) so that there is no conflict.