<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Option type - Page 6 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=option_type&amp;p=5">1.Previous</a><br />
<a accesskey="3" href="page.php?w=option_type&amp;p=7">3.Next</a>
</p>
<p>parameterize a record. To implement a Option type, a Boolean type is used as the discriminant; the following example provides a generic to create an option type from any non-limited constrained type:<syntaxhighlight lang="ada">generic  -- Any constrained & non-limited type.  type Element_Type is private;package Optional_Type is  -- When the discriminant, Has_Element, is true there is an element field,  -- when it is false, there are no fields (hence the null keyword).  type Optional (Has_Element : Boolean) is record    case Has_Element is      when False => Null;      when True  => Element : Element_Type;    end case;  end record;end Optional_Type;</syntaxhighlight></p><p>
<a accesskey="1" href="page.php?w=option_type&amp;p=5">1.Previous</a><br />
<a accesskey="3" href="page.php?w=option_type&amp;p=7">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
