Skip to content

Instantly share code, notes, and snippets.

// Execution Functions
private func turnExteriorLightsOn()
{
leftFrontLight .isOn = true
rightFrontLight.isOn = true
leftBackLight .isOn = true
rightBackLight .isOn = true
}
private func checkForBurnedBulbs()
{
// Router Function
private func turnLights(on shouldTurnLightsOn: Bool)
{
if shouldTurnLightsOn
{
turnExteriorLightsOn()
checkForBurnedBulbs()
}
else { turnExteriorLightsOff() }
// When an if statment has only 1 thing to execute i like to write it
// Management Function
func handleCarStarted()
{
turnLights(on: true)
turnAC(on: true
}