class ToyProgram @inputNum attr_writer:inputNum attr_reader:inputNum @randNum attr_writer:randNum attr_reader:randNum def run() self.randNum = rand * 10 self.inputNum = gets.to_i if self.inputNum > self.randNum then puts "You win" else puts "You lose" end end end a = ToyProgram.new() a.run()