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

  • 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.

主站蜘蛛池模板: 靖边县| 西林县| 遂溪县| 城步| 雅安市| 卢湾区| 张北县| 互助| 滨海县| 合山市| 哈巴河县| 神池县| 奈曼旗| 秦安县| 江山市| 邹城市| 江口县| 当雄县| 长岛县| 农安县| 平谷区| 兴安县| 社会| 金湖县| 宜君县| 阿鲁科尔沁旗| 香河县| 翁牛特旗| 三亚市| 元朗区| 宣汉县| 邹平县| 库伦旗| 惠州市| 井冈山市| 响水县| 许昌县| 巴林右旗| 枞阳县| 枝江市| 樟树市|