Variables and Constants in Swift
In Swift, you can declare variables using the var keyword and constants using the let keyword. Variables can be changed later on, whereas constants cannot be changed once they are set.
swift
var myVariable = 10
let myConstant = 20
myVariable = 15 // valid
myConstant = 25 // invalid
No comments:
Post a Comment