aboutsummaryrefslogtreecommitdiff
path: root/step-02/README:md
diff options
context:
space:
mode:
Diffstat (limited to 'step-02/README:md')
-rw-r--r--step-02/README:md26
1 files changed, 26 insertions, 0 deletions
diff --git a/step-02/README:md b/step-02/README:md
new file mode 100644
index 0000000..4f531be
--- /dev/null
+++ b/step-02/README:md
@@ -0,0 +1,26 @@
+Basic syntax demonstration!
+
+```erlang
+-module(step02).
+-export([double/1]).
+
+double(X) ->
+ 2 * X.
+```
+
+* Statements are terminated with a full stop: ".".
+* `module` declares the name of the module. Should match file name by default.
+* `export` names functions to export out of this module. Will be usable by other modules. The `func/N` syntax means *the function `func`* with *N* arguments.
+* `double(X)` is a function declaration and implementation.
+
+Using this module looks like this:
+
+```
+1> c(step02).
+{ok,step02}
+2> step02:double(4).
+8
+```
+
+* The `c/1` function compiles a module. Notice that it returns ok and a module name.
+* To call the function, the module is explicitly named.