Corrects code that would fail due to type mismatch
I know this probably seems nit-picky since this isn't a language reference, but it seems numberOfWheels should be converted to Float when doing the math here to get tire pressure. Otherwise, I'm loving this style guide!
This commit is contained in:
Родитель
dec6f540b2
Коммит
e102e26b2d
|
@ -190,7 +190,7 @@ class Vehicle {
|
|||
}
|
||||
|
||||
func maximumTotalTirePressure(pressurePerWheel: Float) -> Float {
|
||||
return pressurePerWheel * numberOfWheels
|
||||
return pressurePerWheel * Float(numberOfWheels)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ protocol Vehicle {
|
|||
}
|
||||
|
||||
func maximumTotalTirePressure(vehicle: Vehicle, pressurePerWheel: Float) -> Float {
|
||||
return pressurePerWheel * vehicle.numberOfWheels
|
||||
return pressurePerWheel * Float(vehicle.numberOfWheels)
|
||||
}
|
||||
|
||||
struct Bicycle: Vehicle {
|
||||
|
|
Загрузка…
Ссылка в новой задаче