what is the difference between using the optional and creating normal variable without assigning any value? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the difference between using the optional and creating normal variable without assigning any value?

7th Oct 2016, 1:00 AM
مصطفى دويدار
مصطفى دويدار - avatar
2 Answers
0
normal variable must has a value, but optional can be nil
11th Oct 2016, 3:14 PM
Diluka W
Diluka W - avatar
0
Optional is used when you need to declare a variable but not want to assign that the value at that point.
21st Dec 2016, 9:31 AM
Sushobhit jain
Sushobhit jain - avatar