411 REFERENCE · Wikibooks
Ada Programming/Delimiters/double dot
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Delimiters ..
Ada Programming/Delimiters/..
__TOC__
The delimiter .. is used to specify ranges in any scalar type.
For example:
In numeric type definitions:
type Count is range 0 .. Max_Count;
In subtype definitions:
subtype Week_Day is Day_Name range Monday .. Friday;
In variable declarations:
Vector_A : Vector (0 .. 31);
In membership tests:
exit when X in Y .. Y + Epsilon;
In for loops:
for Day in Day_Name range Monday .. Thursday loop
...
end loop;
In arrays:
Vector_A (Vector_A'First .. Vector_A'First + Vector_B'Length - 1) := Vector_B;
Usage notes
When a whole type range will be specified, it is better to use the Range attribute.
For example, instead of using:
for Day in range Day_Name'First .. Day_Name'Last loop
...
end loop;
it is better to use:
for Day in Day_Name'Range loop
...
end loop;
See also
Wikibook
Ada Programming
Ada Programming/Delimiters
Ada Programming/Attributes/'Range
Ada Reference Manual
2 2 Lexical Elements, Separators, and Delimiters
..