Previous Lecture Complete and continue  

  Data Types in Swift

In Swift, you can assign different data types to your variables or your constants. A data type can be a number (Int), a string of text (String), a single character (Character), a floating point number (Float), a big floating point number (Double) and even a Boolean (Bool). There are more data types, but these are the most common ones.

You can also create variables and constants that can only accept one specific data type, by adding the data type to the declaration of the variable / constant, like this:

var cat:String = "Tom"

In this case, the variable "cat" will only accept values of data type String.

Discussion
1 comments