# Assigning a Variable

Saying what the variable name stands for is called **assigning** the variable. When you update the value, you are assigning it a new value.

{% hint style="info" %}
It's best to give a variable an **initial** or starting value when you create it. Not all languages have a default value and some variables default to a **`null`** value which could create errors.
{% endhint %}

## How to Assign a Value to a Variable

* Text-based code generally uses a single equal sign (`=`)
* What follows the = is what is put in the variable

**Examples:**

*Processing and Java-based example:*

```java
String name = “Hope”;

float opacity = 0.5;              // Equal to 50%
```

*JavaScript example:*

```javascript
var count = 0;
```

*Python example:*

```python
count = 0
```


---

# 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://hopemoore.gitbook.io/coding-for-creatives-spring-2021/glossary-and-terms/variables/assigning-a-variable.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.
