-
-
Save AlchemistCamp/3a700642c92d5e07381ada799205a2fd to your computer and use it in GitHub Desktop.
Episode 80 source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ProcessIntro do | |
def greeter() do | |
receive do | |
_ -> | |
IO.puts("Hello, friend!") | |
end | |
greeter() | |
end | |
def counter() do | |
receive do | |
value -> | |
IO.puts(value) | |
Process.sleep(500) | |
send(self(), value + 1) | |
end | |
counter() | |
end | |
def doubler() do | |
receive do | |
value -> | |
IO.puts(value) | |
Process.sleep(2500) | |
send(self(), value * 2) | |
end | |
doubler() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment