8000 Corrects code that would fail due to type mismatch · dxq-git/swift-style-guide-1@e102e26 · GitHub
[go: up one dir, main page]

Skip to content

Commit e102e26

Browse files
committed
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!
1 parent dec6f54 commit e102e26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Vehicle {
190190
}
191191

192192
func maximumTotalTirePressure(pressurePerWheel: Float) -> Float {
193-
return pressurePerWheel * numberOfWheels
193+
return pressurePerWheel * Float(numberOfWheels)
194194
}
195195
}
196196

@@ -215,7 +215,7 @@ protocol Vehicle {
215215
}
216216

217217
func maximumTotalTirePressure(vehicle: Vehicle, pressurePerWheel: Float) -> Float {
218-
return pressurePerWheel * vehicle.numberOfWheels
218+
return pressurePerWheel * Float(vehicle.numberOfWheels)
219219
}
220220

221221
struct Bicycle: Vehicle {

0 commit comments

Comments
 (0)
0