Tuesday, 4 October 2016

Constants

In this Blogpost, you'll learn constants.

You will learn, how to declare, name and change them. 

You'll also learn about type inference (Swift's most important features).

Constants

let firstConstant: Int = 100 

This declares a constant called 
firstConstant which is of type Int. 
Then it sets the value of the firstConstant to the number 100.

let  
piConstant: Double = 3.141

This is similar to the above constant, except the name and the type are different. 
This time the constant is a Double.

Once you've declared a constant, you can not change its data

No comments:

Post a Comment