'Swift variable conditional initialization: var with default value or let?
In case of a variable that never mutates after initialization, does having a var cause a performance hit? There are situations where it's simpler to write
var value = 0
if conditions {
value = 1
}
than
let value: Int
if conditions {
value = 1
} else {
value = 0
}
Is it negligible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
