We just saw how to declare a variable in swift using the “var” keyword. Now we will learn how to declare constants in swift. To declare constants in swift we make use of the “let” keyword. Constant is a set of value/values which cannot be changed at any time in the program. The constants lets you finalize a value. The …
The first thing we do in any programming language is create variables. So lets get started. In Swift we do this by using a keyword “var“. The variable name is generally camelCased using lowercase first letter, e.g areaOfCircle; preimeterOfSquare; surfaceArea etc.
var areaOfCircle = 200.45
var radiusOfCircle = 50
The first question you will have is do we need to mention its type before we assign a …
Apple presented a new language for iOS and OSX developers called Swift. Its now came to light that Swift was underway since 2010, which is 2 years after the first SDK was released. Apple saw the restrictions of Objective-C which is very nearly 30 years old and decided it was the ideal time for a change. In any case, in …