- Mastering Ethereum
- Merunas Grincalaitis
- 99字
- 2021-06-24 15:01:05
Enums
Enums are fixed size lists with unique names that you define. You can use them as custom modifiers for specific objects, or to hold a specific state in your smart contract. This is ideal for controlling the state of ICOs.
You declare them as follows:
enum Trees { RedTree, BlueTree, GreenTree, YellowTree }
Then, you create the enum variable:
Trees public myFavoriteTree = Trees.RedTree;
Note that you don't have to add a semicolon at the end of the enum declaration, but you do have to add it for the variable with the enum type that you just created.
推薦閱讀
- 感官的盛宴:數(shù)學(xué)之眼看藝術(shù)(萬(wàn)物皆數(shù)學(xué))
- 仿真模型可移植性規(guī)范及其應(yīng)用
- 數(shù)學(xué)可以很有趣:科學(xué)新悅讀文叢(套裝全5冊(cè))
- 數(shù)學(xué)建模:算法與編程實(shí)現(xiàn)
- 一定要懂博弈論
- 模式識(shí)別與人工智能(基于MATLAB)
- 數(shù)學(xué)實(shí)驗(yàn)教程
- 數(shù)學(xué)建模33講:數(shù)學(xué)與繽紛的世界
- 數(shù)理邏輯
- 現(xiàn)代數(shù)值計(jì)算(第2版)
- 數(shù)學(xué)的故事
- 隨機(jī)數(shù)學(xué)及其應(yīng)用
- 無(wú)言的宇宙
- 愛(ài)情數(shù)學(xué)(TED 思想的力量系列)
- 特殊函數(shù)概論習(xí)題解答