What is difference between 'let' and 'var' declaration ?
Answer Posted / iosraj
constants are expressed with the ‘let’ keyword. So once assigned value can not be change, but assigned values using 'var' keyword can be change.
In terms of objective -c or compare with objective -c, 'var' is Mutable and 'let' is NonMutable.
let kMyConstant = 40
Or
let kMyConstant: Int = 40
var myString = "This is my string."
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is an optional in swift?
What is forced unwrapping? Why is it potentially unsafe?
What is the swift main advantage?
What is a guard statement? What is the benefit of using guard statement in swift?
What is cocoa swift?
What is a deinitializer in swift?
Why swift is faster?
How do I add a bridging header in swift?
What is a lazy var in swift?
Is swift memory safe?
Explain grand central dispatch (gdc).
What is difference between weak and strong in swift?
What is property observer in swift?
What is data structure in swift?
What is abstract class in swift?