私は制御フローを理解しているだけです。これまで関数型言語を使用したことがないので、そのすべてが非常に奇妙で混乱しています。誰かが私のためにこれを修正できますか?
-export([main/1, test/2]).
main([]) ->
if
test("blue yellow green", "yellow") == true ->
{io:fwrite("found")};
true ->
{io:fwrite("not found")}
end.
test(Source, Find) ->
Pos = string:str(Source, Find),
if
Pos > 1 ->
{true};
true ->
{false}
end.