Return to Snippet

Revision: 2389
at February 7, 2007 13:52 by andyh


Initial Code
Infinity = 1.0/0

# a rather useless range
everything = -Infinity..Infinity
puts everything.includes?(5) #-> true

# use it for representing an unbounded value
storage_limits => { :demo => 0,
  :standard => 250.megabytes,
  :expert => 1.gigabyte,
  :unlimited => Infinity }

if bytes_used < storage_limits[account_level]
  # add another file or something
else
  # display "out of space" message
end

Initial URL

                                

Initial Description

                                

Initial Title
Uses for Infinity in Ruby

Initial Tags
ruby

Initial Language
Ruby