Language
Version: 4
Categories
-
User Program Communication
-
Variables
-
Control Flow
-
Functions
-
Object Oriented Programming
Variables
Constants in Swift
Constants are identifiers whose associated value cannot be altered during the execution of the program.
Syntax
//implicitly typed
let constantName = value
//explicitly typed
let constantName: DataType = value
Notes
Constants can be implicitly or explicitly typed.
Example
let pi = 3.14159