dname = gets.chomp
pet = Dragon.new dname.capitalize
command = ' '
def prompt
puts 'Name: ' + pet.name+ ' Energy: ' + pet.energy+ ' Food: ' +pet.stuffInBelly+ ' Potty: ' +pet.stuffInIntestine
print 'Enter your command here: '
end
dname = gets.chomp
pet = Dragon.new dname.capitalize
command = ' '
def prompt
puts 'Name: ' + pet.name+ ' Energy: ' + pet.energy+ ' Food: ' +pet.stuffInBelly+ ' Potty: ' +pet.stuffInIntestine
print 'Enter your command here: '
end
dname = gets.chomp
$pet = Dragon.new dname.capitalize
command = ' '
def prompt
puts 'Name: ' + $pet.name+ ' Energy: ' + $pet.energy+ ' Food: ' +$pet.stuffInBelly+ ' Potty: ' +$pet.stuffInIntestine
print 'Enter your command here: '
end
class Foo
@bar = 'foo'
def bar
@bar
end
def bar=(val)
@bar = val
end
end
class Foo
attr_reader :one
attr_writer :two
attr_accessor :three, :four
def initialize
@one,@two,@three,@four = 50
end
end
./drag2.rb:165:in `prompt': undefined local variable or method `pet' for main:Object (NameError)
from ./drag2.rb:171
./drag2.rb:165:in `prompt': undefined local variable or method `pet' for main:Object (NameError)
from ./drag2.rb:171
[edit to add] The problem area starts at line 161.
and here's what shows up:
Enter your command here:
notice the Name: Energy: Food: Potty: all show up but the values don't. any help with this would be very much appreciated.