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.

  • Logical
true
true
false
false
typeof(true)
Bool
  • Integers
1
1
typeof(1)
Int64
Int8(1)
1
typeof(Int8(1))
Int8
  • Floating-Point numbers
10.0
10.0
typeof(10.0)
Float64
Float16(10.0)
Float16(10.0)
typeof(Float16(1))
Float16
  • Complex numbers
1 + 2im
1 + 2im
typeof(1 + 2im)
Complex{Int64}
  • Rational numbers
10 // 15
2//3
typeof(10 // 15)
Rational{Int64}
  • Character
'x'
'x': ASCII/Unicode U+0078 (category Ll: Letter, lowercase)
typeof('x')
Char
typeof('β')
Char
  • Strings
"julia"
"julia"
typeof("julia")
String
  • Symbol: Object used to represent identifiers
:name
:name
typeof(:name)
Symbol
  • Tuples: Unmutable fixed-length container holding any values
("John", 29, 10.0)
("John", 29, 10.0)
typeof(("John", 29, 10.0))
Tuple{String, Int64, Float64}
  • Named tuples: Tuples with element names
(name = "John", age = 29, value = 10.0)
(name = "John", age = 29, value = 10.0)
typeof((name = "John", age = 29, value = 10.0))
NamedTuple{(:name, :age, :value), Tuple{String, Int64, Float64}}
  • Pair: Unmutable object with two elements (first and second)
"January" => 1
"January" => 1
typeof("January" => 1)
Pair{String, Int64}
  • Dictionaries: Table with keys and values.
Dict("Poisson" => 1, "Gaussian" => 2)
Dict{String, Int64} with 2 entries:
  "Gaussian" => 2
  "Poisson"  => 1
typeof(Dict("Poisson" => 1, "Gaussian" => 2))
Dict{String, Int64}