Use let for constants.

let name = "Richard"

and var for variables

Use constants when you can because they are safer, faster and more idiomatic.

Variable names use CamelCase, shouldn't start with a number and can't contain operators.


// this is a one-line comment

\*  this comment spans
      multiple lines. *\


Type definition

struct Person {
  let firstName: String
  let lastName: String
  func sayHello() {
    print("Hello there! My name is \(firstName) \(lastName).")

Type instances

let aPerson = Person(firstName: "Jacob", lastName: "Edwards")
let anotherPerson = Person(firstName: "Candace", lastName:

Console Output:
Hello there! My name is Jacob Edwards.
Hello there! My name is Candace Salinas.

Collection Types

"Swift also supports collection types, which group instances into a single variable. One collection type is called an Array, which stores an ordered list of objects. Another collection type is called a Dictionary, which has keys that help you look up specific values. You can use collections to store multiple objects in a single constant or variable. You'll learn more about collections in a future lesson. ”

Excerpt From: Apple Education. “App Development with Swift.” Apple Inc. - Education, 2017. iBooks.

Type Safety

Type Inference

Required Values


  • Assignment
  • Basic Maths
  • Compound Assignment
  • Order of Operations
  • Type Conversion

Swift Control Flow