Tuesday, April 10, 2018

Swift Data Types



                       




Data Types:
As we discussed in the previous lesson, about variable and variable we have seen that, when we try to assign the String to Int type it was showing error message cannot assign, Here what String and Int are?.

Let discuss then
As shown and described in the above image, different types of datatypes in Swift, commonly used. Reason why there are many datatypes? Is this because system stores different types of data differently.



As we see in above picture variable that we declared as 'str'  and it is declared as to store only data of type string 'Hello, playground test' by a system.

To declare the variable we basically use
var str = "my test home"  here str assumes it should hold data of type string


The other way to declare is 

0 comments:

Post a Comment