---
url: /flow/guide/scripting-reference/data-types/variant.md
---

# Variant (Variant)

## Declaration

`var myvariable : variant`

### Example

```pascal
procedure ScriptEvent (var Value : variant)
var myvariable : variant
begin
myvariable := 123.45;
myvariable := 'this is some text';
myvariable := Date;
myvariable := null;
end
```

## Description

Variant is a special data type that is capable of holding any data type. For instance a Variant could be set to a numeric value or a string value.

As well as holding a value, a Variant can have the value `null`. This means that its value has not been set. You will receive errors if passing a null variant to a function that expects parameters to be a specific data type like Float or String etc.

When referencing a [Field](/flow/guide/scripting-reference/classes/field/) using the `.Value` property you will have the field returned as a Variant. This means it could contain the value `null`. Reference the field using either `.AsString` or `.AsFloat` to have null values converted to blank strings or zero respectively.

::: tip
A null value is different from a blank string. A null value is a variant that has not been set. A blank string is a empty string with no characters. A blank string is set using `MyVariant := '';` while a null is set as `MyVariant := null;`
:::

Once you set a Variant to a value, a internal flag is set which indicates what data type the Variant represents. From that point onwards you should treat the Variant as that data type. For example in the [String (String, Widestring)](/flow/guide/scripting-reference/data-types/string) topic we mention the danger of concatenating strings and numbers without explicit conversion. If you set a Variant to 123.45, it is flagged as a Float and therefore you should explicitly convert it when concatenating to a String.

You can work with Variants using the [Variant](/flow/guide/scripting-reference/functions/variant/) functions.
