# delete() function

The delete() function removes a specific
attribute, value, or subvalue from a dimensioned or dynamic array.

## Syntax

```
delete(dyn.array.exp, ac.exp)
delete(dyn.array.exp, ac.exp, vc.exp)
delete(dyn.array.exp, ac.exp, vc.exp, sc.exp)
```

## Parameter(s)

| dyn.array.exp | Dynamic array from which the specified attribute, value, or subvalue will be deleted. |
| --- | --- |
| ac.exp | Attribute to delete. |
| vc.exp | Value to delete. |
| sc.exp | Subvalue to delete. |

## Description

The delete() function returns a copy of the dynamic array without the deleted
element. It does not change the original string unless specifically
designated in an assignment statement.

CAUTION: Attempting
to delete attribute 0 is undefined and should be avoided.

## Example(s)

This example deletes the value `red` from the dynamic array names. The reference to attribute
1 is required. The absence of attribute marks in `colors` requires it be treated as a single attribute.

```
equ vm to char(253)
colors = "blue":vm:"green":vm:"red":vm:"yellow"
names = delete(colors,1,3)
```

```
read cust.item from cust.file,item-ID else cust.item = ""
locate(date(),cust.item,date.flds;vx) then
write delete(cust.item,date.flds,vx) on cust.file,item-ID
end
```

## See also

- [del statement](https://d3codex.com/pickbasic-flashbasic/del-statement/)
- [delete statement](https://d3codex.com/pickbasic-flashbasic/delete-statement/)
- [BASIC functions](https://d3codex.com/pickbasic-flashbasic/basic-functions/)
- [insert() function](https://d3codex.com/pickbasic-flashbasic/insert-function/)
- [locate statement](https://d3codex.com/pickbasic-flashbasic/locate-statement/)
- [matread statement](https://d3codex.com/pickbasic-flashbasic/matread-statement/)
- [read statement](https://d3codex.com/pickbasic-flashbasic/read-statement/)
- [ereplace() function](https://d3codex.com/pickbasic-flashbasic/ereplace-function/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [Subvalue count expressions](https://d3codex.com/pickbasic-flashbasic/subvalue-count-expressions/)
- [Value count expression](https://d3codex.com/pickbasic-flashbasic/value-count-expression/)
- [write statement](https://d3codex.com/pickbasic-flashbasic/write-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/delete-function/ - part of the D3Codex reference.
