How to express infinity in Ruby?

后端 未结 3 1956
囚心锁ツ
囚心锁ツ 2020-12-08 18:09

Is there a keyword to express Infinity in Ruby?

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 18:28

    No keyword, but 1.9.2 has a constant for this:

    >> Float::INFINITY #=> Infinity
    >> 3 < Float::INFINITY #=> true
    

提交回复
热议问题