Skip to content

Instantly share code, notes, and snippets.

@angelabauer
Created August 27, 2019 08:56
Show Gist options
  • Save angelabauer/29870029c5d8adb22e5c3e29b672f1c0 to your computer and use it in GitHub Desktop.
Save angelabauer/29870029c5d8adb22e5c3e29b672f1c0 to your computer and use it in GitHub Desktop.
import Foundation
struct CalculatorBrain {
var bmi: Float = 0.0
func getBMIValue() -> String {
let bmiTo1DecimalPlace = String(format: "%.1f", bmi)
return bmiTo1DecimalPlace
}
mutating func calculateBMI(height: Float, weight: Float) {
bmi = weight / (height * height)
}
}
@jameszh8888
Copy link

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment