= operator, we can bind a value of any type to a variable name:
defmodule.All named functions must be defined in a module.
def.defp instead.def increment(n) do
n + 1
end
defp private_increment(n) do
n + 1
end
def short_increment(n), do: n + 1
Functions are invoked using the full name of the function with the module name.
The arity of a function is often used when referring to a named function.
# add/3, because the arity is 3
def add(x, y, z), do: x + y + z
Module names should use PascalCase. A module name must start with an uppercase letter A-Z and can contain letters a-zA-Z, numbers 0-9, and underscores _.
Variable and function names should use snake_case. A variable or function name must start with a lowercase letter a-z or an underscore _, can contain letters a-zA-Z, numbers 0-9, and underscores _, and might end with a question mark ? or an exclamation mark !.
Integer values are whole numbers written with one or more digits. You can perform basic mathematical operations on them.
String literals are sequences of characters surrounded by double quotes.
string = "this is a string! 1, 2, 3!"
Integer, Float, String, Tuple, List.Kernel module is a special module.
Kernel. prefix.Comments can be used to leave notes for other developers reading the source code. Single line comments in Elixir are preceded by #.