***
id: 30c48d64-00f8-47a0-9a24-b84492b028bc
slug: /reference/unset
title: unset
description: Unset specified variables.
max-toc-depth: 3
----------------
Unset specified variables. The variables have been set either using the [`set`](/docs/swml/reference/set) command
or as a byproduct of some other statements or methods (like [`record`](/docs/swml/reference/record))
The name of the variable to unset (as a string) or an array of variable names to unset.
## **Variable**
Any variable can be unset by this method.
## **Examples**
### Unset a single variable
```yaml
version: 1.0.0
sections:
main:
- set:
num_var: 1
- play:
url: 'say: The value of num_var is: ${num_var}.'
- unset: num_var
- play:
url: 'say: The value of num_var is ${num_var}.'
```
```json
{
"version": "1.0.0",
"sections": {
"main": [
{
"set": {
"num_var": 1
}
},
{
"play": {
"url": "say: The value of num_var is: ${num_var}."
}
},
{
"unset": "num_var"
},
{
"play": {
"url": "say: The value of num_var is ${num_var}."
}
}
]
}
}
```
### Unset multiple variables
```yaml
version: 1.0.0
sections:
main:
- set:
systems:
hr:
- tracy
- luke
engineering:
john: absent
name: john
- play:
url: 'say: ${systems.hr}'
- unset:
- systems
- name
# this play statement emits an error because `systems` is undefined
# at this point so there's nothing for `play` to say.
- play:
url: 'say: ${systems}'
```
```json
{
"version": "1.0.0",
"sections": {
"main": [
{
"set": {
"systems": {
"hr": [
"tracy",
"luke"
],
"engineering": {
"john": "absent"
}
},
"name": "john"
}
},
{
"play": {
"url": "say: ${systems.hr}"
}
},
{
"unset": [
"systems",
"name"
]
},
{
"play": {
"url": "say: ${systems}"
}
}
]
}
}
```
## **See Also**
* **[Variables and Expressions](/docs/swml/reference/variables)**: Complete reference for SWML variables, scopes, and syntax
* **[set](/docs/swml/reference/set)**: Set variables in the script