Created
June 4, 2020 00:41
-
-
Save nooglersoon/5370bdba153dc455357b839d2c6b6f30 to your computer and use it in GitHub Desktop.
Medium Session: Introduction to Swift's OOP in Indonesia - Part 1C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mobil { | |
func startEngine () { | |
engineStart = true | |
print("Engine is Started!") | |
} | |
func offEngine () { | |
engineStart = false | |
} | |
func carStatus (_ status: String) -> String { | |
if engineStart { | |
switch status { | |
case "P": | |
return " You are in \(statusList[0]) mode! " | |
case "R": | |
return " You are in \(statusList[1]) mode! " | |
case "N": | |
return " You are in \(statusList[2]) mode! " | |
case "D": | |
return " You are in \(statusList[3]) mode! " | |
default: | |
return "You have never drive" | |
} | |
}else{ | |
return "Your car hasn't started" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment