Elixir has a number of types similar to most programming languages.

Integer

Integers are whole numbers.

elixir

# Integers
1
42
100
9001
    

Float

Floats are decimal place numbers.

elixir

# Floats
1.42
9000.1
    

Boolean

Booleans are true or false values.

elixir

# Booleans
true
false
    

Atom

Atoms are constants where the value is the same as the name of the atom. Atoms are similar to symbols in Ruby and are defined with a colon :.

elixir

# Define an atom
:stuff
    

Note

true, false and nil are also atoms, but they do not need to be prefixed with a colon.

String

String are defined by enclosing characters in double quotes "" and are encoded in UTF-8.

elixir

# Define a string
stuff = "stuff"
    

elixir