# StructDelete

Deletes a key from a struct

## Method Signature

```
StructDelete(struct=[modifiableStruct], key=[any])
```

### Arguments

| Argument | Type               | Required | Description       | Default |
| -------- | ------------------ | -------- | ----------------- | ------- |
| `struct` | `modifiableStruct` | `true`   | The struct target |         |
| `key`    | `any`              | `true`   | The key to delete |         |

## Examples

### Remove a key from a struct

Creates a struct then removes a key

[Run Example](https://try.boxlang.io/?code=eJwrzs9NDS4pKk0uUbBVqFbg4nRUsFIw1OHidALSRly11lzFYFmX1JzUklQNhWK4eh0FpUQlBU1rrvKizJJUl9LcAmRZkAQA87UcEg%3D%3D)

```java
someStruct = { 
	A : 1,
	B : 2
};
structDelete( someStruct, "a" );
writeDump( someStruct );

```

Result: Struct with one key-value pair: B 2

### Remove a key from a struct using the member function

Invoking the delete function on a struct is the same as running structDelete.

[Run Example](https://try.boxlang.io/?code=eJwrzs9NDS4pKk0uUbBVqFbg4nRUsFIw1OHidALSRly11lzFcBV6Kak5qSWpGgpKiUoKmtZc5UWZJakupbkFGgoIRSAJACeFGW8%3D)

```java
someStruct = { 
	A : 1,
	B : 2
};
someStruct.delete( "a" );
writeDump( someStruct );

```

Result: Struct with one key-value pair: B 2

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJxljsEKgkAURdfNV1xmo4HgvnAhCtGqwKD1qC8URyfGMYno39NxCqTV43LuuxzR1a2QPSK8wDbJ6YodeKsUD9jmfDzMSdVdM8ckvlhIauTsvWdhiKxSI4pBa%2BoMxDLF0qG9%2B5AiJxnxZA15gIfQkUvY2pWUJBmCqQgNPeEVwni4adWiN3ooDMvsWWr%2BdyoAn4rcbViTH5kAKtEjJ%2BpQ2r9y7RU7g7E2la271r%2FgB5NlXFk%3D)

```java
animals = { 
	COW : "moo",
	PIG : "oink",
	CAT : "meow"
};
// Show current animals
Dump( label="Current animals", var=animals );
// Delete the key 'cat' from struct
StructDelete( animals, "cat" );
// Show animals, cat has been deleted
Dump( label="Animals with cat deleted", var=animals );

```

## Related

* [StructAppend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structappend)
* [StructClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structclear)
* [StructCopy](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structcopy)
* [StructEach](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structeach)
* [StructEquals](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structequals)
* [StructEvery](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structevery)
* [StructFilter](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structfilter)
* [StructFind](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structfind)
* [StructFindKey](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structfindkey)
* [StructFindValue](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structfindvalue)
* [StructGet](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structget)
* [StructGetMetadata](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structgetmetadata)
* [StructInsert](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structinsert)
* [StructIsCaseSensitive](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structiscasesensitive)
* [StructIsOrdered](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structisordered)
* [StructKeyArray](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structkeyarray)
* [StructKeyExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structkeyexists)
* [StructKeyList](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structkeylist)
* [StructKeyTranslate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structkeytranslate)
* [StructMap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structmap)
* [StructNew](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structnew)
* [StructNone](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structnone)
* [StructReduce](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structreduce)
* [StructSome](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structsome)
* [StructSort](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structsort)
* [StructToQueryString](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structtoquerystring)
* [StructToSorted](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structtosorted)
* [StructUpdate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structupdate)
* [StructValueArray](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/struct/structvaluearray)
