[erlang-questions] feedback please

Richard A. O'Keefe ok@REDACTED
Fri Sep 25 02:53:58 CEST 2015


On 24/09/2015, at 5:39 pm, zxq9 <zxq9@REDACTED> quoted:
> 
> ask_action() ->
>     Input = io:get_line("Which action do you need? (W)ithdrawl/(D)eposit? "),
>     case Input of
>         [$w | _] -> withdrawl;
>         [$W | _] -> withdrawl;
>         [$d | _] -> deposit;
>         [$D | _] -> deposit;
>         BadInput ->
>             ok = io:format("You can't seem to '~tp' today...~n"
>                            "Let's try that again...~n",
>                            [BadInput]),
>             ask_action()
>     end.

It's withdrawAl, the action of withdrawing,
not speaking in a funny way.

I'd be more concerned about moving the *string literals* out
into a tuple of strings (for localisation, spelling correction, &c)
than about moving the case expression out.




More information about the erlang-questions mailing list