Have we already discussed this somewhere?

enum MyEnum {
    case 0
    case 1(String)
}

// or

enum MyEnum {
    case `0`
    case `1`(String)
}

let zero: MyEnum = .0
let one = MyEnum.1("Swift")

switch zero {
     
case .0:
   print("zero")

case .1(let string)  
   print(string)
}  

Tuples have this .# syntax, where the number is the index of the tuple value. 
Can’t we allow this on enum cases as well?

This is additive and something for phase 2, but I’d like to know if we want to 
allow this?! :)



-- 
Adrian Zubarev
Sent with Airmail
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to