User Tools

Site Tools


array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
array [2021/04/21 13:53] justinarray [2024/02/17 10:27] (current) justin
Line 46: Line 46:
  
 =====Functions===== =====Functions=====
-The following functions can be used to manipulate or retrieve the values in array.+The following functions can be used to manipulate or retrieve the values in an array.
 ^Name^Description^ ^Name^Description^
 |push_front(value)|Appends a value to the beginning of an array.| |push_front(value)|Appends a value to the beginning of an array.|
Line 52: Line 52:
 |pop_front()|Removes and returns the first value of an array.| |pop_front()|Removes and returns the first value of an array.|
 |pop_back()|Removes and returns the last value of an array.| |pop_back()|Removes and returns the last value of an array.|
-|insert(index, value)|Inserts a value into an array at the specified index.|+|insert(index, value)|Inserts a value into an array at the specified index (starting at 0).| 
 +|remove(index)|Removes a value from an array at the specified index (starting at 0).| 
 +|erase(value)|Removes the first occurrence of the specified value from an array.|
 |clear()|Removes all values from an array.| |clear()|Removes all values from an array.|
 |size()|Returns the number of items in an array.| |size()|Returns the number of items in an array.|
Line 71: Line 73:
 <code bauxite> <code bauxite>
 $my_array.insert(1, $my_value); $my_array.insert(1, $my_value);
 +</code>
 +<code bauxite>
 +$my_array.remove(2);
 +</code>
 +<code bauxite>
 +$my_array.erase($my_value);
 </code> </code>
 <code bauxite> <code bauxite>
array.1619038425.txt.gz · Last modified: 2021/04/21 13:53 by justin