# #warning

## Description

\#warning

Add it at the top of your macro, and you will get warnings if there are undeclared variables used in it.

AGAIN: IMPORTANT: Undeclared variables will slow down macro performance a LOT if they are used over and over, so, fix your macros.

## Use

With #warning added to your macro, the macro will be issue a warning (either in the MQ window or chat window) when it run in to an undefined, and pause. The warning will list the macro line number and line language, so you can go in a fix the macro.

A lot of times this is a matter of using \[\[TLO:Defined|${Defined\[]}]]

As in ${blah} only gets defined in a specific situation... as such the old way of just

`/if (${blah}) /dosomething`

will cause a lot of extra CPU usage. Using #warning will pause the macro and tell you where the problem is, so you can either change the macro to avoid the problem, or simply:

```
/if (${Defined[${blah}]} {
    /if (${blah}) /dosomething
    }
```

## See Also

* [Pound\_Commands](/macroquest/commands/macro-commands/macro-directives.md)
* [Macro\_Reference](/macroquest/documentation/macro-reference.md)
* [TLO:Defined](/macroquest/data-types-and-top-level-objects/top-level-objects/tlo-defined.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://macroquest.gitbook.io/macroquest/commands/macro-commands/macro-directives/warning.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
