# 12.1 全局变量

最简单粗暴的变量是全局变量。这意味着这个变量在同一时间只有一个值，而且这个值在通常情况下会贯穿整个 Lisp 程序。直到你定义一个新的全局变量重载掉原来的变量。而旧的值就会永远消失。

你可以使用 setq 来给一个符号声明值 (value)，比如：

```
(setq x '(a b))
```

将 value (a b) 赋值给 变量 x 。注意， setq 是一个特殊表达式，而不是函数（详情查阅 特殊表达式）；Lisp 不会对第一个参数求值，而是对第二个参数求值，并将求值结果作为这个符号的值。

一旦一个变量拥有了 值(value)，你就可以将对应的符号作为表达式求值，进而引用这个值，就像这样，

```
x => (a b)
```

如果你重复赋值，那么新值会覆盖掉旧值：

```
x
    => (a b)
(setq x 4)
    => 4
x
    => 4
```

·\`


---

# 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://emacs-lisp.ivory.cafe/bian-liang/untitled.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.
