What is difference between 'let' and 'var' declaration ?



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

Post New Answer

More Apple iOS Swift Interview Questions

How should errors be handled in swift?

0 Answers  


How can you make a property optional in swift?

0 Answers  


Is swift a good language to learn?

0 Answers  


What are the control transfer statements in swift?

0 Answers  


Why we use lazy in swift?

0 Answers  






Explain some biggest changes in usernotifications.

0 Answers  


How does a swift transfer work?

0 Answers  


How many access levels are present in swift?

0 Answers  


What is the swift main advantage?

0 Answers  


What is a string swift?

0 Answers  


What is forced unwrapping? Why is it potentially unsafe?

0 Answers  


What is a lazy var in swift?

0 Answers  


Categories