ABSTRACT

This chapter reviews Swift's basic syntax in detail, learn about its components and widgets. Like C, Swift uses variables to store and refer to values by an identifying name. Swift also makes extensive use of variables whose values cannot be changed. Constants are used throughout Swift to make code safer and cleaner in intent when student work with values that do not need to change. As a standard, constants and variables should be declared before they are used. In case a stored value in student's code will not change, make sure to declare it as a constant with the let keyword. And use variables only for storing values that need to be modified in the future. It is possible to include a type annotation when student declare a constant or variable, to be clear about the kind of values the constant or variable can store.