3.3 Common values
In this section, we provide a quick introduction to common basic objects. The function
typeof
used below returns the type of object provided as argument.
- Integers
1
1)
typeof(# Int64
- Floating-Point numbers
10.0
10.0)
typeof(# Float64
- Complex numbers
1 + 2im
1 + 2im)
typeof(# Complex{Int64}
- Rational numbers
10 // 15
10 // 15)
typeof(# Rational{Int64}
- Character
'x'
'x')
typeof(# Char
- Strings
"julia"
"julia")
typeof(# String
- Tuples: fixed-length container holding any values
10.0, 2, "string")
(10.0, 2, "string"))
typeof((# Tuple{Float64,Int64,String}
- Named tuples: Tuples with element names
10.0, b = 2, c = "string")
(a = 10.0, b = 2, c = "string"))
typeof((a = # NamedTuple{(:a, :b, :c),Tuple{Float64,Int64,String}}