programming:elixir:hello_world
This is an old revision of the document!
Hello world !
IO.puts("Hello world!")
Interactive Elixir Session
iex
Help
h
On elixir, functions do not modify values. Functions transforms values on output.
Example :
name = "Toto" if (name == "Toto") do IO.puts("Inside condition before being changed: " <> name) name = "Robin" IO.puts("Inside condition after being changed: " <> name) end IO.puts("Outside condition after being changed: " <> name)
Output :
Inside condition before being changed: Toto Inside condition after being changed: Robin Outside condition after being changed: Toto
Example with date :
d1 = ~D[2023-04-25] IO.puts(d1) IO.puts(Date.add(d1, 5)) IO.puts(d1)
Output :
2023-04-25 2023-04-30 2023-04-25
programming/elixir/hello_world.1682408237.txt.gz · Last modified: 2023/04/25 07:37 by ateixeira