From WikiChip
Difference between revisions of "mirc/commands/unset"
< mirc‎ | commands

(Created page with "The '''/unset command''' removes any variables by their specified names. If a wildcard pattern was specified, all variables matching that pattern will be removed. The /unset c...")
(No difference)

Revision as of 05:16, 6 December 2013

The /unset command removes any variables by their specified names. If a wildcard pattern was specified, all variables matching that pattern will be removed. The /unset command can be used to remove both local and global variables, however it can only remove one of them per name. Local variables take precedence over a global variable with the same name.

Unset Evaluation Routine

Due to unset's special evaluation routine, no evaluation brackets are needed when unsetting dynamic variables:

unset %foo $+ $bar

Synopsis

/unset [-q] <%var> [%var2 [%var3...]]

Switches

  • -s - say (prints) debug output

Parameters

None

Example

The most basic usage is to unset a specific variable:

/unset %foobar

Local variables take precedence over a global variable with the same name.

alias global_local {
  set %foo 1
  var %foo 2
  echo -a %foo
  unset %foo
  echo -a %foo
  unset %foo
}

Which will produce the following result:

2
1

/unset can only remove a local or global variable per each name specified, however it’s possible to remove both by specifying the variable name twice, for example:

alias global_local2 {
  set %foo 1
  var %foo 2
    
  ; unset both at once
  unset %foo %foo
  
  ; will print empty quotes
  echo -a $qt(%foo)
}

Which will print empty quotes:

""

No evaluation brackets are needed when unsetting dynamic variables:

alias dynamic_vars {
  var -s %foo. $+ $calc(1+2) Test
  var -s %bar. $+ $calc(1+3) Test
 
  unset -s %foo. $+ $calc(1+2) %bar. $+ $calc(1+3)
}

Which will produce the following results:

* Set %foo.3 to Test
-
* Set %bar.4 to Test
-
* Unset %foo.3
-
* Unset %bar.4

Compatibility

Added: mIRC v4.0

Added On: 20/03/96


Note: Individual switches were not taken into consideration.

See also