Skip to content

Instantly share code, notes, and snippets.

@sigwinch28
Created April 24, 2018 21:16
Show Gist options
  • Save sigwinch28/dd1d706a900f695feb0e077b885625ae to your computer and use it in GitHub Desktop.
Save sigwinch28/dd1d706a900f695feb0e077b885625ae to your computer and use it in GitHub Desktop.
Strings in Erlang
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.3 (abort with ^G)
1> str:print("Here's a hint").
Char: H
Char: e
Char: r
Char: e
Char: '
Char: s
Char:
Char: a
Char:
Char: h
Char: i
Char: n
Char: t
Done
ok
2>
-module(str).
-export([print/1]).
print([]) ->
io:format("Done~n");
print([Char|Chars]) ->
io:format("Char: ~c~n", [Char]),
print(Chars).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment