0
我最近開始學習erlang,但遇到了一個讓我不解的錯誤。Erlang之前的語法錯誤:'end'
錯誤是syntax error before: 'end'
在最後一行。我看了一些試圖找到錯誤的例子,但我現在完全迷失了。有任何想法嗎?
ChannelToJoin = list:keysearch(ChannelName,1,State#server_st.channels),
case ChannelToJoin of
% Channel exists.
{value, Tuple} ->
if
%User is not a member of the channel
not list:member(UserID, Tuple) ->
%Add the user to the channel
Tuple#channel.users = list:append(Tuple#channel.users, [UserID]);
% If the user is already a member of the channel.
true -> true
end;
%Channel doesn't exist
false ->
%Create new channel and add the user to it.
NewState = State#server_st{channels = list:append(State#server_st.channels, NewChannel = #channel{name = ChannelName, users = [UserID]}
end
你能發表更多的代碼嗎?除了你試圖更新'if'中的'Tuple'記錄外,這對我來說看起來很好。請記住:erlang中的變量是隻讀的 – ZeissS