| www.delorie.com/gnu/docs/gcc/gnat_ug_119.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The value of a variable may be restricted to a list of string literals. The restricted list of string literals is given in a string type declaration.
Here is an example of a string type declaration:
type OS is ("NT, "nt", "Unix", "Linux", "other OS");
|
Variables of a string type are called typed variables; all other
variables are called untyped variables. Typed variables are
particularly useful in case constructions
(see 10.3.8 case Constructions).
A string type declaration starts with the reserved word type, followed
by the name of the string type (case-insensitive), followed by the reserved
word is, followed by a parenthesized list of one or more string literals
separated by commas, followed by a semicolon.
The string literals in the list are case sensitive and must all be different. They may include any graphic characters allowed in Ada, including spaces.
A string type may only be declared at the project level, not inside a package.
A string type may be referenced by its name if it has been declared in the same project file, or by its project name, followed by a dot, followed by the string type name.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |