ruby
class Person
def name
"私は、ピーターだよ"
end
def brain
"計算する"
end
def tall
170
end
def weight
"60kg"
end
def walk
"トコトコ"
end
end
person = Person.new
person.name
person.brain
person.tall
person.weight
person.walk
javascript
class Person{
constructor(name,age,tall){
this.name = name
this.age = age
this.tall = tall
}
evaluation(){
var score = this.age * this.tall
if (score >= 80){
console.log("cool")
}else{
console.log("not so cool")
}
}
}
bob = new Person("bob",23,170)
console.log(bob.name) # bob
console.log(bob.evaluation) # cool