---
name: "getFSMVariable"
type: command
status: ok
groups: ["Variables"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/getFSMVariable
revid: 330370
updated: 2022-09-04T20:25:49Z
---

# getFSMVariable

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

## Description

Return the value of variable in the variable space of given FSM. The FSM handle is the number returned by the [execFSM](../commands/execFSM.md) command.

## Syntax

### Syntax 1

```sqf
FSMhandle getFSMVariable name
```

**Parameters:**

- `FSMhandle`: [Number](../topics/Number.md)
- `name`: [String](../topics/String.md) - name of the variable

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

### Syntax 2

*since arma3 1.68*

```sqf
FSMhandle getFSMVariable [name, defaultValue]
```

**Parameters:**

- `FSMhandle`: [Number](../topics/Number.md)
- `name`: [String](../topics/String.md) - name of the variable
- `defaultValue`: [Anything](../topics/Anything.md) - value to return if variable is [nil](../commands/nil.md)

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

## Examples

### Example 1

```sqf
_handle getFSMVariable "_foo";
```

### Example 2

```sqf
_handle getFSMVariable ["_foo", 123];
```

## See also

FSM · [commandFSM](../commands/commandFSM.md) · [completedFSM](../commands/completedFSM.md) · [doFSM](../commands/doFSM.md) · [execFSM](../commands/execFSM.md) · [setFSMVariable](../commands/setFSMVariable.md)

<sub>Source: [BI Community Wiki — getFSMVariable](https://community.bistudio.com/wiki/getFSMVariable) (revision 330370).</sub>
