What is meant by type annotations mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is meant by type annotations mean?

Type annotations means it ensure that your code is clear about the constant or variable declared

25th Nov 2016, 11:07 AM
joffie
joffie - avatar
1 Answer
- 1
Swift is extremely good in inferring the variable type, so you don't use much type annotation. Let me show you: var age = 10 Swift inferred an Int type to age, but you can type annotate it too, like this: var age: Int; var age = 10
25th Nov 2016, 3:37 PM
Felipe Cruz
Felipe Cruz - avatar