官术网_书友最值得收藏!

  • Mastering Ethereum
  • Merunas Grincalaitis
  • 112字
  • 2021-06-24 15:01:05

Arrays

Arrays allow you to store large amounts of the same type of variable in one place. They are used as lists that contain a specific type of information for your smart contracts so that you can store your data in an orderly manner. They can be accessed with a simple for loop by getting the length of them.

You can create arrays of uints, strings, structs, addresses, and pretty much any other type:

uint256[] public myNumbers;
string[] public myTexts;

You can also delete elements from an array with the following keyword:

delete myTexts[2];

You can also use .push() and .pop() to add or remove elements from the array in dynamically-sized arrays.

主站蜘蛛池模板: 高邑县| 砀山县| 射阳县| 乐东| 罗源县| 上思县| 句容市| 务川| 剑河县| 湟源县| 潜山县| 库伦旗| 双牌县| 霍邱县| 禄丰县| 大悟县| 准格尔旗| 新营市| 武宣县| 彰武县| 宁乡县| 大城县| 新乡市| 油尖旺区| 商水县| 宁强县| 西乌珠穆沁旗| 宜州市| 赞皇县| 额济纳旗| 启东市| 大新县| 灵川县| 家居| 汶上县| 邻水| 大方县| 社会| 杭锦旗| 区。| 天水市|