How can I properly write an erlang program that divides 10 by a number and then returns the result, and monitors the process at the same time, exiting and starting over if 0 is entered?
-module(division).
-export([loop/0]).
loop() ->
receive
0 ->exit({divisor,die,at,erlang:time()});
_ ->io:format("Division Result: ", [ _= 10 / _ ]), loop()
end.
>Erland
Unless you're going to work for Ericsson, what's the point?
use codeblocks ffs
Using _ matches any value but does not bind it. just replace _ with X. Starting over is what supervisor should do. Learn OTP and fucking basics of the language.