When to prefer `and` over `andalso` in guard tests

前端 未结 4 840
别那么骄傲
别那么骄傲 2021-02-02 08:48

I am curious why the comma ‹,› is a shortcut for and and not andalso in guard tests.

Since I\'d call myself a “C native” I fail to see any shor

4条回答
  •  盖世英雄少女心
    2021-02-02 09:21

    It's an historical reason. and was implemented before andalso, which was introduced in Erlang 5.1 (the only reference I can find right now is EEP-17). Guards have not been changed because of backwards compatibility.

提交回复
热议问题