# Assignment

Assignment is the process of assigning the value of an
expression to a variable.

The variable can be a simple variable, an array element,
a dynamic array element, a substring, or all of the above.

## Syntax

```
variable = expression
```

## Example(s)

Variable `name` is assigned the string `“george”`.

```
name = "george"
```
Variable `result` is assigned to the result
of the arithmetic expression.

```
result = (unit.price * qty)
```
Variable `line` is assigned the result
of the string expression.

```
line = result: " is the answer"
```
Adds the value of `code` as the last attribute
of the dynamic array item.

```
item<-1> = code
```
Adds the value of `code` as the last value
in an attribute of codes.

```
item<codes,-1> = code
```
Value `fred`, is assigned to the fifth
element of the dimensioned array `customer.array`.

```
customer.array(5) = "fred"
```
Second subvalue in the second value in the first attribute
of the string in item is replaced with the string `“100”`.

```
item<1,2,2> = "100"
```
Character positions 3 and 4 of string are replaced with
the string `“ca”`.

```
string[3,2] = "ca"
```
Third and fourth character positions of the string found
in the first subvalue in the second value in the first attribute of
item is replaced with the string `“ca”`.

```
item<1,2,1>[3,2] = "ca"
```

## See also

- [*= assignment operator](https://d3codex.com/pickbasic-flashbasic/asterisk-equals-assignment-operator/)
- [+ arithmetic operator](https://d3codex.com/pickbasic-flashbasic/plus-arithmetic-operator/)
- [+= assignment operator](https://d3codex.com/pickbasic-flashbasic/plus-equals-assignment-operator/)
- [-= assignment operator](https://d3codex.com/pickbasic-flashbasic/minus-equals-assignment-operator/)
- [/= assignment operator](https://d3codex.com/pickbasic-flashbasic/slash-equals-assignment-operator/)
- [: relational operator](https://d3codex.com/pickbasic-flashbasic/colon-relational-operator/)
- [:= assignment operator](https://d3codex.com/pickbasic-flashbasic/colon-equals-assignment-operator/)
- [= assignment operator](https://d3codex.com/pickbasic-flashbasic/equals-assignment-operator/)
- [> relational operator](https://d3codex.com/pickbasic-flashbasic/greater-than-relational-operator/)
- [Array references](https://d3codex.com/pickbasic-flashbasic/array-references/)
- [Arrays](https://d3codex.com/pickbasic-flashbasic/arrays/)
- [Arrays and relational expressions](https://d3codex.com/pickbasic-flashbasic/arrays-and-relational-expressions/)
- [assigned() function](https://d3codex.com/pickbasic-flashbasic/assigned-function/)
- [cat relational operator](https://d3codex.com/pickbasic-flashbasic/cat-relational-operator/)
- [clear statement](https://d3codex.com/pickbasic-flashbasic/clear-statement/)
- [Data representation](https://d3codex.com/pickbasic-flashbasic/data-representation/)
- [equate statement](https://d3codex.com/pickbasic-flashbasic/equate-statement/)
- [extract() function](https://d3codex.com/pickbasic-flashbasic/extract-function/)
- [insert() function](https://d3codex.com/pickbasic-flashbasic/insert-function/)
- [let statement](https://d3codex.com/pickbasic-flashbasic/let-statement/)
- [mat statement](https://d3codex.com/pickbasic-flashbasic/mat-statement/)
- [Nuclear tokens](https://d3codex.com/pickbasic-flashbasic/nuclear-tokens/)
- [Substring expressions](https://d3codex.com/pickbasic-flashbasic/substring-expressions/)
- [Substring expressions](https://d3codex.com/pickbasic-flashbasic/substring-expressions/)
- [Substring expressions](https://d3codex.com/pickbasic-flashbasic/substring-expressions/)
- [Substring expressions](https://d3codex.com/pickbasic-flashbasic/substring-expressions/)
- [\= assignment operator](https://d3codex.com/pickbasic-flashbasic/backslash-equals-assignment-operator/)

---
Source: https://d3codex.com/pickbasic-flashbasic/assignment/ - part of the D3Codex reference.
