Accessing an Enumeration association value in Swift

后端 未结 7 742
情深已故
情深已故 2020-11-27 14:46

In this code I\'ve written a really useless enum that defines a possible Number with Int or Float.

I can\'t understand how can I access the value that

相关标签:
7条回答
  • 2020-11-27 15:06

    I have used something like this:

    switch number {
    case .int(let n):
        println("integer is \(n)")
    case .float(let n):
        println("float is \(n)")
    }
    
    0 讨论(0)
提交回复
热议问题