Erlang basics · Lesson 29 (open contents)
Make the promise executable
Can parsing and counting each work alone yet count a trailing empty segment as a line when connected?
Before running: In erl run {ok, nb_contract} = c(nb_contract, [debug_info]), eunit:test(nb_contract). Run tests only after compilation succeeds. Exported count/1 appears in default EDoc output with its @doc text; use rebar3 edoc for project docs and rebar3 dialyzer for spec analysis.
PredictWill the trailing newline add one to the tested line count?
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 17 · Put one tested module in Rebar3Lesson 23 · Describe the data contractLesson 27 · Parse one real lineLesson 28 · Keep the public API small
Go deeper: full examples, original exercises and further reading →