# Option data type
> Version: _Available or changed with runtime version 1.0._
Denotes an option value. In the code snippet below, you can see how the Option data type is declared.
## Syntax example
```al
procedure HelloWithOptions(OptionParameter : Option Alpha, "Bra-vo")
    var
        OptionVariable : Option C, "or D";
    begin
        Message('%1',OptionParameter::Alpha);
        Message('%1',OptionVariable::C);
    end;
```
> NOTE
> It is not possible to reference the members of the OptionParameter from outside the body of the procedure.
## Remarks
In the OptionString Property<../../properties/devenv-optionmembers-field-property> of the field or variable, you can enter the option values as a comma-separated list. The Option type is a zero-based enumerator type, which means that the option values are assigned to sequential numbers, starting with 0. You can convert option data types to integers.
## Example 1
The following code sample shows how to define an option field in a table.
```al
field(0; PreferredContactMethodCode; Option)
{
    Caption = 'Preferred Method of Contact';
    // The OptionMembers property must be defined on an option field. It specifies which values can the field take.
    OptionMembers = Any,Email,Phone,Fax,Mail;
}
```
## Example 2
This example shows how you can use the value of an option field as a constant in your AL code.
```al
PurchHeaderRec."Document Type" := PurchHeaderRec."Document Type"::Invoice;
```
## Related information
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/option/option-data-type, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/option/option-data-type/
