Skip to content

Instantly share code, notes, and snippets.

@AlexPinhasov
Last active November 18, 2019 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexPinhasov/4ebc212e1c7d094bc7acc55906001f52 to your computer and use it in GitHub Desktop.
Save AlexPinhasov/4ebc212e1c7d094bc7acc55906001f52 to your computer and use it in GitHub Desktop.
class CarFleet {
func moveCarsToPosition(cars: [Car], position: Position) {
cars.forEach({
if Toggles.Vehical.carsCanFly.enabled {
fly(to: location)
} else {
drive(to: location)
}
})
}
func refuel(cars: [Car]) {
cars.forEach({
if Toggles.Vehicle.Car.carsCanFly.enabled {
refuel(car: $0, using: Fuel.rocket)
} else {
refuel(car: $0, using: Fuel.car)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment