Today we learn how to define and store a value
there are different types of value, we introduce 4 of them
- bool is data type indicate yes or no
let is_this_apple: bool = true
let is_this_orange: bool = false
: bool is type hint, tell compiler type of the variable we define is bool, normally we omit the type hint, as compiler is smart enough to infer the type itself, so we can also define as below
let is_this_apple = true
let is_this_orange = false
- int is integer
let number_of_people_in_family: int = 5
- string is a section of text
let dream_of_girl = "have food with grandma in warm place"
- float and double is decimal, a number with fraction part
let price_of_milk = 1.19
Top comments (0)