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

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

主站蜘蛛池模板: 呼伦贝尔市| 大荔县| 龙山县| 瑞安市| 玛多县| 东平县| 博白县| 称多县| 北辰区| 湖口县| 陇川县| 唐海县| 长春市| 兴和县| 哈尔滨市| 永安市| 五寨县| 南皮县| 垦利县| 安达市| 读书| 文安县| 砚山县| 石门县| 五常市| 乌鲁木齐县| 秦皇岛市| 德阳市| 西乌珠穆沁旗| 明水县| 广宁县| 满城县| 郁南县| 闽清县| 额尔古纳市| 台南市| 乌拉特前旗| 湖南省| 黑龙江省| 临沂市| 南溪县|