# UNDEF

> [HTML Version](undef.htm)

**UNDEF <symbol>**

The UNDEF directive cancels (undefines) a symbol created by a prior [DEFINE](define_compiler.md), [DEFALIAS](defalias.md) or [DEFTYPE](deftype.md) directive.

For example:

\++IFDEF Flavor\_of\_the\_Month\$

    ++MESSAGE Out with the old flavor (Flavor\_of\_the\_Month\$)

    UNDEF Flavor\_of\_the\_Month\$

    DEFINE Flavor\_of\_the\_Month\$ = "Marmite"

\++ELSE

    ++MESSAGE Flavor of the month program not currently active

\++ENDIF



Note that in the above case, without the UNDEF, the DEFINE statement would generate a "redefined symbol" error unless the new definition was the same as the prior one. On the other hand, an UNDEF of a symbol that hasn't yet been defined is **not** considered an error, so the above ++IFDEF would only be necessary or sensible if the objective was to change the flavor of the month only if a flavor of the month had already been established, and otherwise to leave it undefined.

**History**

2022 June, A-Shell 6.5.1717, compiler edit 994:  UNDEF extended to work on DEFALIAS definitions. It previously worked only for DEFINEs.