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
How is swift different from objective-c?
Why is swift important?
Why swift is safe?
Explain swift vs objective-c.
Does swift have a garbage collector?
What is the meaning of question mark "?" In swift?
What are the advantages of using swift?
Is singleton thread safe swift?
What is swiftnet?
What is selector swift?
Explain the common execution states for a swift ios app (ios application lifecycle).
How to create a constant in swift programming?
What are the collection types that are available in swift?
Can enum conform to swift protocol?
How do I create a bridge header in swift 4?