I was wondering if I could have a case statement return a different value if a variable was true or false.
var variable = false
enum enumeraton {
case thing
var value: Int {
switch self {
case .thing:
if variable = true {
return 1
}else {
return 2
}
}
}
}
is there anyway to do this?
Aucun commentaire:
Enregistrer un commentaire