What is difference between 'let' and 'var' declaration ?
Answer / 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 |
Which compiler is used in swift?
What is the difference between closure and function in swift?
What is race condition in swift?
Mention what are the collection types available in Swift?
Consider the following code: var defaults = NSUserDefaults.standardUserDefaults() var userPref = defaults.stringForKey("userPref")! printString(userPref) func printString(string: String) { println(string) } Where is the bug? What does this bug cause? What’s the proper way to fix it?
What is a tuple in swift?
What is mvvm in swift?
What is singleton in swift?
What is a function in swift?
What is mutable and immutable in swift?
What is weak in swift?
What is property observer in swift?