Array.delete
Array.delete
Function
Delete the element at the specified index.
Syntax
array.delete(index)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| index | Int | No | -1 | The index to delete. |
Return value
| Type | Description |
|---|---|
| Bool | Returns true if the deletion is successful; returns false if the subscript is invalid. |
Example
items = [1, 2, 3] result = items.delete(1) // Output: true print result // Output: [1,3] echo(items)
Notes
- This method will modify the original array.