2 -- { dg-output "1 2 3 4 5 6 7 \| 1- 1 2 3 2- 1 2 3 3- 1 2 3 4- 1 2 3 5- 1 2 3" }
4 with Ada
.Text_IO
; use Ada
.Text_IO
;
7 type Int_Range
is record
10 with Iterable
=> (First
=> First
,
14 Has_Element
=> Has_Element
,
17 function First
(IR
: Int_Range
) return Integer is (IR
.First
);
18 function Last
(IR
: Int_Range
) return Integer is (IR
.Last
);
19 function Next
(IR
: Int_Range
; N
: Integer) return Integer is (N
+ 1);
20 function Previous
(IR
: Int_Range
; N
: Integer) return Integer is (N
- 1);
21 function Has_Element
(IR
: Int_Range
; N
: Integer) return Boolean is
22 (N
in IR
.First
..IR
.Last
);
23 function Element
(IR
: Int_Range
; N
: Integer) return Integer is (N
);
25 IR
: Int_Range
:= (1, 10);
28 A_Loop
: for I
of IR
loop
30 exit A_Loop
when I
= 7;
34 B_Loop
: for I
of IR
loop
36 C_Loop
: for J
of IR
loop
41 exit B_Loop
when I
= 5;