like a float:
if i == 2.0 i want to get: 2
if i == 2.3 or 2.23 i开发者_开发问答 want to get: 2.3 or 2.23
Use this expression. Just insert it wherever you want the result:
i.to_i == i ? i.to_i : i
like a float:
if i == 2.0 i want to get: 2
if i == 2.3 or 2.23 i开发者_开发问答 want to get: 2.3 or 2.23
Use this expression. Just insert it wherever you want the result:
i.to_i == i ? i.to_i : i
上一篇:生双胞胎的几率有多少??
精彩评论