---
name: "a = b"
type: command
operator: "="
status: ok
groups: ["Variables"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/a_%3D_b
revid: 348661
updated: 2023-11-08T13:49:04Z
---

# a = b

*Command · Variables · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

## Description

Assigns the result of expression on the right to the variable on the left. Technically this is not a command and it is not listed in [supportInfo](../commands/supportInfo.md); this is more of a compiler instruction.

> [!IMPORTANT]
> The following structure is invalid: `a = b = c = 4;`.

## Syntax

```sqf
variable = value
```

**Parameters:**

- `variable`: [Anything](../topics/Anything.md) - see [Identifier](../topics/Identifier.md)
- `value`: [Anything](../topics/Anything.md)

**Returns:** [Nothing](../topics/Nothing.md) 

> [!IMPORTANT]
> The returned value is not equivalent to [nil](../commands/nil.md). See [#Notes](../commands/a_~3D_b.md#notes) below for additional information.

## Examples

### Example 1

```sqf
_value = 5;
```

### Example 2

```sqf
_mygroup = group player;
```

### Example 3

```sqf
_greeting = "Hello!";
```

### Example 4

```sqf
private _enemyTank = myTank1;
```

## See also

[Operators](../topics/Operators.md)

## Community notes

**Kronzky** — 2006-12-15

A conditional assignment can be done via the following syntax:

```sqf
_msg = if (alive player) then {"you're alive"} else {"you're dead"}
```

---

**Alef** — 2009-06-22

It's possible to assign to [Number](../topics/Number.md)s. Numbers values are not changed. Useful instead of assigning to *nul* or *nil* when a result is of no use.

```sqf
[player] execVM "myScript.sqf"
```

---

**Dedmen** — 2016-11-09

This operator actually does not return a Nil. It really returns pure Nothing. Not Nil Nothing.

This can cause problems. For example:

```sqf
_var1 = call {
    _var2 = "";
};
```

The return value of the "call" is the return value of the "=" operator.

If it were a nil then of cause "_var = nil;" would work just fine.

But in reality this causes a "Generic Error in expression" because you can't assign pure Nothing to anything

<sub>Source: [BI Community Wiki — a = b](https://community.bistudio.com/wiki/a_%3D_b) (revision 348661).</sub>
