unset

View as MarkdownOpen in Claude

Unset specified variables. The variables have been set either using the set command or as a byproduct of some other statements or methods (like record)

unset
string | string[]Required

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

1version: 1.0.0
2sections:
3 main:
4 - set:
5 num_var: 1
6 - play:
7 url: 'say: The value of num_var is: ${num_var}.'
8 - unset: num_var
9 - play:
10 url: 'say: The value of num_var is ${num_var}.'

Unset multiple variables

1version: 1.0.0
2sections:
3 main:
4 - set:
5 systems:
6 hr:
7 - tracy
8 - luke
9 engineering:
10 john: absent
11 name: john
12 - play:
13 url: 'say: ${systems.hr}'
14 - unset:
15 - systems
16 - name
17 # this play statement emits an error because `systems` is undefined
18 # at this point so there's nothing for `play` to say.
19 - play:
20 url: 'say: ${systems}'

See Also