首页 > 编程语言 > 详细

swift语言点评八-枚举

时间:2018-04-03 18:55:20      阅读:204      评论:0      收藏:0      [点我收藏+]

总结:swift中的枚举可以看作变量可以作为case匹配参数的类

 

Enumerations

 枚举的作用:状态列举与匹配

 

枚举值与类型

If a value (known as a “raw” value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.

You can define a common set of related cases as part of one enumeration, each of which has a different set of values of appropriate types associated with it.

 

Enumerations in Swift are first-class types in their own right.

computed properties

instance methods

继承、协议

 

case

 

简化

 

match

 

.语法

 

swift语言点评八-枚举

原文:https://www.cnblogs.com/feng9exe/p/8710270.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!