ruby - `-': nil can't be coerced into Fixnum (TypeError) -


I get an error in my program that says. /ruby_camping.rb:91:in `- ': can not be zero, what I would like to do in complying with FixName (type error), that guest has to checkout that I have just checked. Here is the block of code for the checkout section:

  def self.check_out "Welcome to checkout!" $ Puts camps. Current_guests says, "These are current guests, what do you want for a checkout?" Puts "state conspiracy number" plot = gets.chomp.to_i guest = $ camping.current_guests [plot-1] says "Date for your checkout (if a number is large" + guest.arrived.to_s + "): "# It should not be possible for the guest to checkout before checking for the departure of the guest. Data = becomes. Chomp.To_ Guest Guest Dated = Departure Date - Guest. Not valid. The guest has been checked in "+ guest.arrived.to_s puts" Please tell a new date. Departure date = gets.chomp.to_i guestStayedDays = Departure date - Guest. The ending end guest.Departure = departureDate guest.plot.Incate (guest stadiaz) # Guest Guest to the electricity meter Guest # Printing Guest $ are camping. Courant_Guestusts [plot-1] = zero # ends the end of conspiracy  

How is the departure date still zero? Thanks for the help!

To get a more detailed answer, you must indicate which line line in your program was. However, to indicate you in the right direction, if you are looking at , then it can not be resolved then it means on the right side - Is zero . E.g.

  irb (main): 001: 0> 5 - Nil type error: can not be zeroed in the FixNum (IRB): 1: of (IRB): 1  

The only possible example of this with my code is GuestStaydius = View department date - can view with guest so I'll check the value of guest.arrived .

If the - of zero example to the left hand side departure date or < Code> plot then you will get the undefined method '-' for zero: NilClass .


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -