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
Who invented swift code?
Is ios written in swift?
What is set swift?
What is data type in swift?
Does swift support multiple inheritance?
Can structs inherit swift?
Why we use delegates in swift?
What collection types are available in swift?
What are the different ways to pass data in swift?
What is an in-out parameter in swift?
What is lazy loading in ios swift?
What is difference between xcode and swift?
What is a protocol in swift?
Is swift open source?
Which compiler is used in swift?