Enum with Raw Values in Swift
Level 279 keystrokes
Defines an enum whose cases have Int raw values and prints the raw value of .done, 1.
Swift code
// : Int after the name sets the raw value type1enum Status: Int { // Each case gets an explicit raw value2 case pending = 03 case done = 14}// rawValue returns the value assigned to the case: 15print(Status.done.rawValue)Output
1
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Swift code and how often they appear.
.× 2=× 2:× 1(× 1)× 1{× 1}× 1