# unassigned() function

The unassigned() function indicates whether a variable has an
 assigned value.

## Syntax

```
unassigned(var)
```

## Parameter(s)

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

## Description

The unassigned() function returns a non-zero value (true) if the variable
 (*var*) is currently unassigned. If the variable has an assigned value, a 0
 (false) is returned.

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

 The unassigned() 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.

## Example(s)

Use the unassigned() function when an application attempts to open files
 only once and keeps the file variables in a COMMON block.

 It is more effective to modify the open statements in existing programs,
 for example:

```
if unassigned(var) then open ... to var ...
```

 This can be done rather than change the application to open all files as soon as the user logs
 on and remove all subsequent open statements from all other existing
 programs.

## See also

- [= assignment operator](https://d3codex.com/pickbasic-flashbasic/equals-assignment-operator/)
- [assigned() function](https://d3codex.com/pickbasic-flashbasic/assigned-function/)
- [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/)

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