tags:

views:

52

answers:

1

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

thanks

+2  A: 

Use this expression. Just insert it wherever you want the result:

i.to_i == i ? i.to_i : i
Adrian