September 2013
Intermediate to advanced
548 pages
12h 25m
English
The Erlang shell has a number of built-in commands. You can
see them all with the shell command help().
| | 1> help(). |
| | ** shell internal commands ** |
| | b() -- display all variable bindings |
| | e(N) -- repeat the expression in query <N> |
| | f() -- forget all variable bindings |
| | f(X) -- forget the binding of variable X |
| | h() -- history |
| | ... |
All these commands are defined in the module
shell_default.
If you want to define your own commands, just create a module
called user_default. Here’s an example:
| user_default.erl | |
| | -module(user_default). |
| | |
| | -compile(export_all). |
| | |
| | hello() -> |
| | "Hello Joe how are you?". |
| | |
| | away(Time) -> |
| | io:format("Joe is away and will be back in ~w minutes~n", |
| | [Time]). |
Once this has been compiled ...
Read now
Unlock full access