$ iex
Erlang/OTP 21 [erts-10.1.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> c("pushbutton.ex")
[Pushbutton]
iex(2)> Pushbutton.start()
{:ok, #PID<0.109.0>}
iex(3)> Pushbutton.get_count()
0
iex(4)> Pushbutton.push()
:on
iex(5)> Pushbutton.get_count()
1
iex(6)> Pushbutton.push()
:off
iex(7)> Pushbutton.get_count()
1
iex(8)> Pushbutton.stop()
:ok
iex(9)> Pushbutton.push()
** (exit) exited in: :gen_statem.call(:pushbutton_statem, :push, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(stdlib) gen.erl:228: :gen.do_for_proc/2
(stdlib) gen_statem.erl:598: :gen_statem.call_dirty/4
iex(9)>
Created
January 3, 2019 20:48
-
-
Save peerreynders/926b05c04511193b1544e565faa292c7 to your computer and use it in GitHub Desktop.
Erlang gen_statem module documentation "state_functions" callback mode example "translated" to Elixir
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment