Skip to content

Instantly share code, notes, and snippets.

@dixpac
Last active April 10, 2016 19:33
Show Gist options
  • Save dixpac/3350c9fa24ad9168340385a795d45fa7 to your computer and use it in GitHub Desktop.
Save dixpac/3350c9fa24ad9168340385a795d45fa7 to your computer and use it in GitHub Desktop.
Calculate BMI using instance varaibles
class Person
def initialize(weight, height)
@weight = weight
@height = height
end
def bmi
(@weight / (@height * @height))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment