- Hands-On Design Patterns with Swift
- Florent Vilmart Giordano Scalzo Sergio De Simone
- 62字
- 2021-07-02 14:44:58
Simple enums
Let's say you're building a smart light remote control; you can easily represent the state of this light with the following enum:
enum State {
case on
case off
}
let anOnLight = State.on
This is a very simple example, and we could have used a Boolean value, but with the enum, we set ourselves up for expansion.
推薦閱讀
- GitHub Essentials
- 有趣的二進(jìn)制:軟件安全與逆向分析
- 數(shù)據(jù)庫原理及應(yīng)用教程(第4版)(微課版)
- Visual Studio 2015 Cookbook(Second Edition)
- Learning Spring Boot
- Oracle RAC 11g實(shí)戰(zhàn)指南
- 數(shù)據(jù)庫系統(tǒng)原理及應(yīng)用教程(第4版)
- 數(shù)據(jù)要素五論:信息、權(quán)屬、價(jià)值、安全、交易
- Spark大數(shù)據(jù)分析實(shí)戰(zhàn)
- Python數(shù)據(jù)分析與挖掘?qū)崙?zhàn)(第3版)
- 跨領(lǐng)域信息交換方法與技術(shù)(第二版)
- Gideros Mobile Game Development
- 大數(shù)據(jù)數(shù)學(xué)基礎(chǔ)(R語言描述)
- 代碼的未來
- ORACLE 11g權(quán)威指南