Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 944 Bytes

File metadata and controls

42 lines (33 loc) · 944 Bytes

Interactive Shell

One of the easiest ways to execute Elixir commands is by simply running the iex command on Linux and macOS, or iex.bat on Windows, since the iex command there is a PowerShell command in the terminal.

IEX stand for Interactive Elixir

$ iex
Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.17.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Note
To exit the Interactive shell just press CTRL+C twice.

Examples of Interactive Shell

iex(1)> 1 + 2
3
iex(2)> 1.1 + 2
3.1
iex(3)> 6 / 2
3.0
iex(4)> IO.puts("This is a text")
This is a text
:ok
Note

The :ok is a common convention in Elixir and Erlang to signify that a function has completed without errors. It can be useful for confirming that an operation, such as printing to the console, has been executed properly.