RosettaCodeData/Task/Enumerations/Ruby/enumerations-1.rb

12 lines
204 B
Ruby
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
module Fruits
APPLE = 0
BANANA = 1
CHERRY = 2
end
# It is possible to use a symbol if the value is unrelated.
FRUITS = [:apple, :banana, :cherry]
val = :banana
FRUITS.include?(val) #=> true