Erlang 帮助:在匿名函数中使用 If 语句

Erlang help: Using an If Statement in an anonymous function

所以我安装了 IntelliJ 的 Erlang 插件,我 运行 遇到了障碍。我有一个匿名函数,我在其中插入了一个 if 语句。这应该有效,但没有。

Max_Fun = fun(X, Max) -> if
                          X > Max -> X;
                          X <= Max -> Max
                         end

看到我的问题是小于或等于比较具有红色波浪下划线。当我将鼠标悬停在它上面时,我被告知“'<=' unexpected ” 为什么会发生这种情况,我该如何解决?

应该是这样的:

Max_Fun = fun(X, Max) -> if
                                 X > Max -> X;
                                 X =< Max -> Max
                             end
              end.

When I hover over it I am told " '<=' unexpected " Why is this happening and how can I fix it?

erlang 中的一个简单规则是比较运算符永远看起来不像箭头。所以当你认为你应该输入 <= 它实际上是 =<