9.5 Undefining Variables

9.5.1 Synopsis

undef (variable);

9.5.2 Description

Variable called variable is undefined; in other words Cows behaves as if it were never been defined.

If you want to erase variable's content without undefining it, you can simply assign it an empty string:

variable = "";

This way, if you later use variable, Cows won't raise any warning.

If you try to undefine a non existing variable Cows will raise a warning; you can avoid it by placing the undef statement inside an ifdef block:

ifdef (variable) {
  undef (variable);
}

9.5.3 Example

quote = "When a man wants to murder a tiger, it's called
sport; when the tiger wants to murder him it's called ferocity.
-- George Bernard Shaw ";
print (quote);
undef (quote);
print (quote);

This quotation is printed only once because of the undef statement:

When a man wants to murder a tiger, it's called
sport; when the tiger wants to murder him it's called ferocity.
-- George Bernard Shaw

This manual can be downloaded from http://www.g-cows.org/.