我有这样的代码用if语句正试图获取用户输入yes或no如果用户输入比对请求被拒绝的任何其他。 这是我的错误:
** exception error: no match of right hand side value "yes\n"
in function messenger:requestChat/1 (messenger.erl, line 80)
代码在这里:
requestChat(ToName) ->
case whereis(mess_client) of
undefined ->
not_logged_on;
_ -> mess_client ! {request_to, ToName},
request_to = io:get_line("Do you want to chat?"),
{_, Input} = request_to,
if(Input == yes) ->
ok;
true -> {error, does_not_want_to_chat}
end
end.