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
- let vs var: Constants and Variables
- Type Inference and Explicit Types
- Numbers, Booleans and Characters
- String Fundamentals and Interpolation