I have written this code in ruby but it just opens up a window and then closes again immediatley, can anyone point out the problem?
#Orange Tree program #You can pick an orange or leave it for a year. #For three years it will produce no fruit. #It will then produce more fruit every year until it dies #It dies at 20 years #It grows 20 cm every year class OrangeTree def initialize @age = 0 @orange = 0 @height = 50 @deathyear = 20 @announcement = "That orange was lovely!"#see pickAnOrange method below puts "You have planted a new Orange Tree" end def height puts "The orange tree is" + @height + "cm tall." end def oneYearPasses if @age >= 3 @orange = @age*rand(5) + 4 end @age += 1 @height += 20 end def countTheOranges puts "Counting the oranges now" puts "There are currently " + @orange + " oranges on the tree." end def pickAnOrange if @orange = 0 puts "There aren't any oranges on the Tree" elsif @orange = 1 puts announcement puts "That was the last orange this year" else @orange -= 1 puts announcement end end gerbil = OrangeTree.new