DEV Community

pooyaalamdari
pooyaalamdari

Posted on

constant

class Ticket 
    VENUES = ["Convention center", "Fairy", "Town hall" ]

    def initialize(venue, date)
        if VENUES.include?(venue)
            @venue = venue 
        else  
            raise ArgumentError, "Unknown venue #{venue}"
        end
        @date = date 
    end
end

puts "the venues are: "
puts Ticket::VENUES
Enter fullscreen mode Exit fullscreen mode

Image description

change constant

#change constant 
venues = Ticket::VENUES
venues << "High school Gym"
Enter fullscreen mode Exit fullscreen mode

Image description

Top comments (0)