Math.const_set and get : Math.constants « Development « Ruby






Math.const_set and get


Math.const_set(:EPI, Math::E*Math::PI)
Math.const_get(:EPI)             # => 8.53973422267357
Math.const_defined? :EPI         # => true

 








Related examples in the same category

1.To find out what constants Math (or any other module or class) has defined, use reflection by invoking the constants method
2.Euler and PI