在同一个代码块中使用 2 个“end”似乎总是有问题,例如:
Worker = fun (File) ->
{ok, Device} = file:read_file([File]),
Li = string:tokens(erlang:binary_to_list(Device), "\n"),
Check = string:join(Li, "\r\n"),
FindStr = string:str(Check, "yellow"),
if
FindStr > 1 -> io:fwrite("found");
true -> io:fwrite("not found")
end,
end,
消息是“之前的语法错误:'end'”