What is the output of the following code?
Examine the following code snippet:
enum Figure: Int { case FelixTheCat case Baby case Girl case SpiderMan = 9 case Man case Superman case Batman }
What is the output for the following statements?
var d = Figure.Man
print(d.rawValue)
d = Figure.Baby
print(d.rawValue)
10 1
The output for the following statements is as follows.
The statements in bold are the values implicitly assigned by the compiler.
enum Figure: Int { case FelixTheCat // = 0 case Baby // = 1 case Girl // = 2 case SpiderMan = 9 case Man // = 10 case Superman // = 11 case Batman // = 12 } var d = Figure.Man print(d.rawValue) //prints out 10--- d = Figure.Baby/*from www .j av a 2 s.com*/ print(d.rawValue) //prints out 1---