> For the complete documentation index, see [llms.txt](https://macroquest.gitbook.io/macroquest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://macroquest.gitbook.io/macroquest/commands/macro-commands/declare.md).

# /declare

## Syntax

**/declare** ***varname*****|*****varname\[array extents]*** **\[type] \[local|global|outer] \[*****defaultvalue*****]**

## Description

This creates a variable or array of a particular type with a particular scope, and a default value if desired. The parameters must be given in order, but any after *varname* may be skipped to use the defaults.

**Notes**

* The default type is string
* The default scope is local
* The default value is nothing (empty string, or 0)

These variables can be of any type that exist in MQ2DataVars. The variable will then have access to the members of that type.

## See Also

* [MQ2DataVars](https://github.com/macroquest/docs/blob/master/documentation/mqdatavars.md) for extensive information on variables and how to manipulate them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/declare.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.
