Overview - Var for variables (mutable)
What is it?
In Swift, 'var' is a keyword used to declare variables that can change their value after being set. Unlike constants declared with 'let', variables declared with 'var' are mutable, meaning you can update their contents anytime. This allows your program to store information that can vary as it runs, like a score in a game or a user's name. Using 'var' helps your code handle changing data smoothly.
Why it matters
Without 'var', you would only have constants that never change, making it impossible to write programs that respond to new information or user actions. Imagine a calculator that can only add numbers once and never update the result; it would be useless. 'Var' solves this by letting your program remember and update values, making apps interactive and dynamic.
Where it fits
Before learning 'var', you should understand basic Swift syntax and the difference between values and types. After mastering 'var', you can learn about constants with 'let', optionals, and how to manage data flow in your app.