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

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.

主站蜘蛛池模板: 绿春县| 乐至县| 昭觉县| 和顺县| 安徽省| 循化| 太白县| 仁化县| 四平市| 安福县| 尚义县| 巴彦淖尔市| 柳江县| 宜良县| 宜丰县| 新余市| 黔西| 大连市| 苗栗市| 佳木斯市| 同心县| 武城县| 中西区| 钟山县| 吉隆县| 高雄县| 崇文区| 射阳县| 宁阳县| 大竹县| 合江县| 特克斯县| 闸北区| 尚志市| 辽宁省| 岑溪市| 隆安县| 余江县| 锦州市| 河南省| 西和县|