Crell / enum-comparison

A comparison of enumerations and similar features in different languages
80 stars 7 forks source link

Swift example #5

Closed iluuu1994 closed 4 years ago

iluuu1994 commented 4 years ago
case Suit {
    case hearts(String)
    case diamonds(String)
    case clubs(String)
    case spades(String)
}

I get that every language uses the same example for better comparison. It would be easier to demonstrate that each case holds its own set of associated values with a different example where each case holds different arity and type of assoc values.