# assigned() function

The assigned() function determines if
the variable has been assigned a value.

## Syntax

```
assigned(var)
```

## Parameter(s)

| var | Variable to check for assignment. |
| --- | --- |

## Description

If var has
an assigned value, a nonzero value (true) is returned. If no value
is assigned, 0 (false) is returned.

The assigned() function determines if common variables have been previously
 assigned.

The assigned() function works well in BASIC subroutines called from the
 call AQL processing code. It prevents files from being repeatedly opened and
 variables from continually being re-initialized.

Tip: Rocket advises programmers
to not rely on the assigned() function to return
a specific nonzero value. Its exact value is undefined and can vary
between implementations.

## Example(s)

The following example determines if the file variable *fv.entity* has been
 assigned previously with the file statement. If it has not been assigned, the
 file statement is executed.

```
if not(assigned(fv.entity)) then file entity
```

## See also

- [= assignment operator](https://d3codex.com/pickbasic-flashbasic/equals-assignment-operator/)
- [Assignment](https://d3codex.com/pickbasic-flashbasic/assignment/)
- [clear statement](https://d3codex.com/pickbasic-flashbasic/clear-statement/)
- [common statement](https://d3codex.com/pickbasic-flashbasic/common-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [unassigned() function](https://d3codex.com/pickbasic-flashbasic/unassigned-function/)

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