📌 📄 内容摘要:
KIKO (@KaylonChan) 在 写了一早上的代码一直报错,求助大佬 中发帖
import Foundation
enum KfcError: Error {
case insufficientAmount(message: String)
}
func kfcOffer(thankAmount: Int) throws {
if thankAmount >= 50 {
print(“KFC Crazy Thursday Offer Accepted! 🍗”)
} else {
throw KfcError.insufficientAmount(message: “Whoever gives me 50 CNY, I will thank him and get KFC!”)
}
}
do {
try kfcOffer(thankAmount: 0)
} catch KfcError.insufficientAmount(let messa...
────────── 链接信息 ────────── 🔗 论坛链接: linux.do 📎 访问地址: https://linux.do/t/topic/234341/1 ─────────────────────────────
📢 来源:LINUX DO