File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ = begin pod
2
+
3
+ = TITLE class Label
4
+
5
+ = SUBTITLE Labels for control operations such as C < next > and C < last >
6
+
7
+ class Label { ... }
8
+
9
+ In Perl 6, you can give for example loops a label, and use it to control that
10
+ loop (instead of the inner-most loop).
11
+
12
+ USERS: # the label
13
+ for @users -> $u {
14
+ for $u.pets -> $pet {
15
+ # usage of a label
16
+ next USERS if $pet.barks;
17
+ }
18
+ say "None of {$u}'s pets barks";
19
+ }
20
+ say USERS.^name; # Label
21
+
22
+ Those label are objects of type C < Label > .
23
+
24
+ = head1 Methods
25
+
26
+ = head2 method next
27
+
28
+ method next(Label:)
29
+
30
+ Begin the next iteration of the loop assoicated with the label.
31
+
32
+ = head2 method last
33
+
34
+ method last(Label:)
35
+
36
+ Terminate the execution of the loop assoicated with the label.
37
+
38
+ = end pod
You can’t perform that action at this time.
0 commit comments