Created
March 28, 2018 08:14
-
-
Save CenoX/8979d19b6ed2dd99b93afb3f81a37cd4 to your computer and use it in GitHub Desktop.
King-God-Emperor-ChungMuGong-Majesti-General-Development Master God GyungDal
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
enum Rank { | |
case top | |
case mid | |
case low | |
func whoIsHim() -> String { | |
if self == .top { return "GyungDal" } | |
return "I don't know" | |
} | |
} | |
enum RankError: Error { | |
case HeIsDenying | |
} | |
struct GyungDal { | |
public private(set) var rank = Rank.top | |
var isHeThinksHeIsNotTopRanker = true | |
func checkHim() throws { | |
if isHeThinksHeIsNotTopRanker { | |
throw RankError.HeIsDenying | |
} else { | |
print("Yeah. GyungDal is Top Ranker") | |
} | |
} | |
init() {} | |
} | |
var gyungDal = GyungDal() | |
do { | |
try gyungDal.checkHim() | |
} catch RankError.HeIsDenying { | |
print("Fuck. He is denying that he is top ranker!!") | |
print("We should change his mind.") | |
gyungDal.isHeThinksHeIsNotTopRanker = false | |
dump(gyungDal) | |
print("Jung2GooHyun Done.") | |
try gyungDal.checkHim() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment