Last active
April 10, 2016 19:33
-
-
Save dixpac/3350c9fa24ad9168340385a795d45fa7 to your computer and use it in GitHub Desktop.
Calculate BMI using instance varaibles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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