0
class Place
@description = "Default place"
def initialize(x : Int32, y : Int32, description : String)
@x = x
@y = y
@description = description
puts "Description of this place is: #{description}"
end
end
require "./browser-game/*"
require "./places/*"
module Browser::Game
# TODO Put your code here
place = Place.new 2, 3, "Yay new description"
puts place.description
puts "End of the program"
end
我收到此錯誤:獲得實例屬性,而不是未定義的方法
Error in browser-game.cr:8: undefined method 'description' for Place
puts place.description ^~~~~~~~~~~
我喜歡你的編碼設置 –
@LucaAngioloni謝謝!強烈推薦用於Mac的Cathode終端應用程序,帶有來自Alien的聲音(第一部電影) – idchlife