Packages

Prompt user with question and return answer in callback

Current section

Files

Jump to
question src question_erl.erl
Raw

src/question_erl.erl

-module(question_erl).
-export([question/2]).
%% Prompt user with question and return answer in callback
question(Prompt, Cb) ->
Answer = io:get_line(Prompt),
case Answer of
eof ->
init:stop();
_ ->
Cb(string:trim(Answer))
end.