💧 Elixir
Beginner
What are Elixir data types?
Answer
Elixir's core data types: Integers and Floats: 42, 3.14. Atoms: named constants — :ok, :error, true, false, nil. Module names are atoms. Strings: UTF-8 binaries — "hello". Strings support interpolation: "Hello, #{name}". Charlists: lists of code points — 'hello' (single quotes — legacy, mostly for Erlang interop). Lists: linked lists — [1, 2, 3]. Prepend O(1): [0 | list]. Tuples: fixed-size collections — {:ok, 42}. Random access O(1). Maps: key-value stores — %{name: "Alice", age: 30}. Structs: named maps with defined keys — %User{name: "Alice"}. Binaries: raw byte sequences — <<1, 2, 3>>. Functions: first-class values. All Elixir data is immutable — operations return new values.