0Pricing
Swift Academy · Lesson

let vs var: Constants and Variables

Understanding immutability with let and mutability with var in Swift.

Welcome

In Swift, every value you work with is either a *constant* or a *variable*. Choosing correctly is one of the first habits that makes your code safer and easier to understand.

Declaring a Constant with let

Use `let` to declare a constant. Once assigned, its value never changes: ```swift let appName = "CoddyKit" let maxScore = 100 ``` The compiler enforces this — attempting to reassign will cause a compile error.

All lessons in this course

  1. let vs var: Constants and Variables
  2. Type Inference and Explicit Types
  3. Numbers, Booleans and Characters
  4. String Fundamentals and Interpolation
← Back to Swift Academy