-module(tested).
-export([main/0]).
main() ->
        loop().
loop() ->
        case io:fread( "","~d" ) of
                eof ->
                        true;
                {ok, X} ->
                        [Y] = X,
                        if
                                Y == 42 ->
                                        true;
                                true ->
                                        io:fwrite( "~B\n",X ),
                                        loop()
                        end
        end.
  • created

    Aug '10
  • last reply

    Jun '12
  • 1

    reply

  • 1.1k

    views

  • 2

    users

1 year later

[bbone=erlang,426]
-module(tested).
-export([main/0]).
main() ->
case io:get_line("") of
{error, Why} -> io:format(Why);
"42\n" -> void;
Data -> io:format("~s~n",[Data]), main()
end.

%% your module MUST be named "tested"
[/bbone]