상수 [constant, 常數]
변하지 않고 항상 같은 값을 가지는 수를 말한다. 상수란 변하지 않고, 항상 일정한 값을 갖는 수를 말한다.
Constants refer to fixed values that a program may not alter during its execution. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal.
Constants Declaration
Before you use constants, you must declare them using let keyword as follows −
let constantName = <initial value>
Following is a simple example to show how to declare a constant in Swift 4 −
Live Demo
let constA = 42
print(constA)
When we run the above program using playground, we get the following result −
42
www.tutorialspoint.com/swift/swift_constants.htm
Swift - Constants - Tutorialspoint
Swift - Constants Constants refer to fixed values that a program may not alter during its execution. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are enumera
www.tutorialspoint.com
'Programming > Swift' 카테고리의 다른 글
Swift Optionals (0) | 2020.10.13 |
---|---|
Enumeration (열거형: list) (0) | 2020.10.13 |
Functions with Parameters (0) | 2020.10.12 |
Introduction to Functions (0) | 2020.10.12 |
Apple's Basic Operators documentation for Swift (0) | 2020.10.08 |