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

< Variable Declaration   |   Optionals >

© 2018 SyntaxDB. All Rights Reserved.