Erlang basics · Lesson 25 (open contents)
01 · Open erl02 · Meet common terms03 · Tell two kinds of text apart04 · Bind a variable once05 · Split and filter a list06 · Parse a number safely07 · Choose one path with case08 · Let a function keep going09 · Put code in a module10 · Compare terms and Boolean results11 · Read and update nested maps12 · Build and inspect UTF-8 binaries13 · Let clauses choose the function path14 · Solve a list twice15 · Choose with patterns, guards, and errors16 · Describe a module and one record17 · Put one tested module in Rebar318 · Return success or failure as data19 · Read and write one file safely20 · Build a data pipeline with functions21 · Keep records behind a module boundary22 · Define a module contract23 · Describe the data contract24 · Test small rules and whole flows25 · Shape builds and make a command26 · Write the project promise27 · Parse one real line28 · Keep the public API small29 · Make the promise executable30 · Package the edge and leave clues31 · Prove the project is done
ERLANG / 25

Shape builds and make a command

With no path argument, will the entry point treat the empty list as a filename?

Before running: In erl run {ok, nb_entry} = c(nb_entry), nb_entry:main([]). To package, run {ok, nb_entry} = c(nb_entry), ok = escript:create("nb_entry.escript", [shebang, {beam, "nb_entry.beam"}]). After both succeed, open another system terminal in the same directory and run escript nb_entry.escript report.txt. Recompile and repackage after edits.

Save as nb_entry.erl · Click a line for its note

PredictWill main([]) print a path or usage? What does it return?

These are fixed example results. This page does not execute code on your computer. Full project examples and reference material are on the deeper page.

Used here: Lesson 04 · Bind a variable onceLesson 09 · Put code in a moduleLesson 17 · Put one tested module in Rebar3

Go deeper: full examples, original exercises and further reading →