-2
我的Ruby代碼...未初始化的常量Person_instance(NameError)
class Person
attr_accessor :name, :age, :gender
person_instance = Person.new
person_instance.name = "Konstantin"
person_instance.age = 19
person_instance.gender = "male"
end
puts person_instance.age
我的錯誤在Ruby中......
C:/Users/Balu/RubymineProjects/learning/test:10:in '<top (required)>': uninitialized constant Person_instance (NameError)
from -e:1:in 'load'
from -e:1:in '<main>'
過程與exit code 1
完成。
局部變量不能在課堂外訪問,你想要做什麼? –