var mean in Swift?var is used to declare a variable that can change its value later. It means the value is mutable.
score with the value 10 using var?You write: var score = 10. This means score can be changed later.
let instead of var?let creates a constant, which means its value cannot change. Trying to change it causes an error.
var instead of let?Use var when you want to change the value later, like a score in a game. Use let when the value stays the same.
var count = 5 count = 10 print(count)
The output is 10 because count was changed from 5 to 10.
var declares a mutable variable. let declares a constant.
let constant?let constants cannot be changed. Trying to do so causes an error.
name with value "Anna"?var name = "Anna" declares a variable that can be changed later.
let creates a constant that cannot be changed.
var x = 3 x = 7 print(x)
The variable x is changed to 7, so it prints 7.
var and let in Swift.