diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a3bc985 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hello.beam diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..78986cd --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.PHONY: erl_compile erl_run clean + +erl_compile: + erlc hello.erl + +erl_run: erl_compile + erl -noshell -s hello start -s init stop + +clean: + rm -f *.beam diff --git a/hello.erl b/hello.erl new file mode 100644 index 0000000..1fa41d1 --- /dev/null +++ b/hello.erl @@ -0,0 +1,14 @@ +% Stephan Wehner (2025) +% Erlang +% https://www.erlang.org/ +% +% Usage: +% $ erlc hello.erl +% $ erl -noshell -s hello start -s init stop +-module(hello). +-export([start/0]). + +start() -> +  Input = io:get_line("What is your name? "), +    Name = string:strip(Input, right, $\n), + io:format("Hello, ~s!~n", [Name]).