erlang day1

This commit is contained in:
Max Hohlfeld 2023-08-14 09:36:36 +02:00
parent fd69c6e68c
commit f40104937d

13
erlang/day1.erl Normal file
View File

@ -0,0 +1,13 @@
-module(day1).
-export([charcount/1]).
-export([counter/1]).
-export([print/1]).
charcount([]) -> 0;
charcount([_ | Rest]) -> 1 + charcount(Rest).
counter(10) -> 10;
counter(N) -> counter(N + 1).
print(success) -> io:write("success");
print({error, Message}) -> io:write(unicode:characters_to_list(["error: ", Message], utf8)).