# $ Isn't Part of the Variable Name

Big gotcha.

![image049.png](/files/-LA8qUcsiZ-99Rb0a6pK)

Can you predict what happened?

![image051.png](/files/-LA8qUdIHBuoj7dIFbaZ)

You see, the $ is not part of the variable's name. If you have a variable named example, that's like having a box with "example" written on the side. Referring to example means you're talking about the box itself. Referring to $example means you're messing with the contents of the box.

So in my example, I used $example=5 to put 5 into the box. I then created a new variable. The new variable's name was $example - that isn't naming it "example," it's naming it the contents of the "example" box, which is 5. So I create a variable named 5, that contains 6, which you can see by referring to $5.

Tricky, right? Comes up all the time:

![image053.png](/files/-LA8qUdxwV1SRUx8wtDI)

In that example, I used the -ErrorVariable parameter to specify a variable in which I would store any error that would occur. Problem is, I used $x. I should have used x by itself:

![image055.png](/files/-LA8qUel0_CC-efEHFzR)

That will store any error in a variable named x, which I can later access by using $x to get its contents - meaning, whatever error was stored in there.


---

# 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://devops-collective-inc.gitbook.io/the-big-book-of-powershell-gotchas/usd-isnt-part-of-the-variable-name.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.
