So I just reached the end of the variables portion of swift and it gives me an option to do an optional task. I am a bit confused to the solution. See my side note.
var height: Double = 1.85
var weight: Double = 82
var bmi: Double <-------- Why is the var bmi given Double
This is initialising the variable, but not assigning anything to it. That means the variable, while it exists, doesn’t hold any value (or it holds the default Swift value). bmi needs to be a Double, because you want it to be able to hold decimal places. For instance, if height was 3, and weight was 10, then you’d get bmi = 10/9 = 1.111 (recurring). If bmi was just an integer, then you’d lose accuracy.