Is there a pop functionality for solidity arrays?

前端 未结 3 1086
失恋的感觉
失恋的感觉 2021-02-20 10:36

I have used solidity to push data into an array. Is there a similar function for pop ?

string[] myArray;
myArray.push(\"hello\")

What is the be

3条回答
  •  渐次进展
    2021-02-20 11:11

    Yes there is, as of v0.5.0 (details here):

    Dynamic storage arrays and bytes (not string) have a member function called pop that you can use to remove an element from the end of the array. This also implicitly calls :ref:delete on the removed element.

提交回复
热议问题