Reputation: 213
I'm receiving an Uninitialized constant error from my code. I have searched around with no luck. Any help would be highly appreciated.
Class Die
def initialize
roll
end
def roll
@num_showing = 1 + rand(6)
end
def showing
@num_showing
end
def cheat
puts "Enter the die # (1-6)"
@num_showing = gets.chomp
while @numshowing > 6 and @numshowing < 0
puts "Enter the die # (1-6)"
@num_showing = gets.chomp
end
end
puts Die.new.cheat
Upvotes: 0
Views: 210
Reputation: 20766
Class
to class
end
at the end of the class definition. Looks like you're not closing the while
loop.Upvotes: 2