Why is nil > 0 true in Erlang?

后端 未结 1 1446

Erlang is the first language I come across to give true for nil > 0.

What is the story behind this decision?

Other languages seem to behave differently.

相关标签:
1条回答
  • 2021-01-18 07:06

    In Erlang, Any term may be compared with any other term. The ordering for Erlang Term Comparisons is:

    number < atom < reference < fun < port < pid < tuple < map < nil < list < bit string
    

    thus nil > 0 is true more information on Term Comparisons

    0 讨论(0)
提交回复
热议问题