When declaring a Double type parameter variable in Swift, the following exception was thrown when performing operations.
Binary operator '*' cannot be applied to two 'Double?' operands
Situation one
Parameter types do not match, parameter types need to be matched
self.max = height / (length * width) // 初始
self.max = height / (length * Double(width)) // 改后
Situation 2
The variable of the initial definition parameter may be empty, add a blank condition, and add the "!" character at the end of the declared parameter
let length = Double(self.lengthText)!
let width = Double(self.weightText)!
let height = Double(self.heightText)!
self.max = height / (length * width)
The above is all the content shared this time, I hope it can be helpful to everyone!