-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

iOS 17 Programming for Beginners
By :

Now that you know about the simple data types that Swift supports, let's look at how to store them so that you can perform operations on them later.You can use constants or variables to store values. Both are containers that have a name, but a constant's value can only be set once and cannot be changed after they are set, whereas a variable's value can be changed at any time.You must declare constants and variables before you use them. Constants are declared with the let
keyword while variables are declared with the var
keyword.Let's explore how constants and variables work by implementing them in your playground. Follow these steps:
let theAnswerToTheUltimateQuestion = 42
let pi = 3.14159
let myName = "Ahmad Sahar"
Click the Run button on the last line to run it. In each case, a container is created and named, and the assigned value is stored in...