File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ To handle all exceptions use a C<default> statement.
63
63
}
64
64
65
65
66
- ## Exceptions handlers and enclosing blocks.
66
+ ## Exceptions handlers and enclosing blocks.
67
67
68
68
After a CATCH has handled the exception, the block enclosing the CATCH is left.
69
69
@@ -72,39 +72,38 @@ as enclosing block gets left immediately:
72
72
73
73
74
74
die "something went wrong ...";
75
-
75
+
76
76
CATCH {
77
77
# will definitely catch all the exception
78
78
default { .Str.say; }
79
79
}
80
-
80
+
81
81
# but this line will be never reached
82
82
# as once default exception handler
83
83
# gets executed
84
84
# a enclosing block - mainline of the program
85
85
# will be left immediately
86
86
87
87
say "This won't be said.";
88
-
89
-
88
+
90
89
Output:
91
90
92
91
something went wrong ...
93
92
94
93
Compare with this one:
95
94
96
95
CATCH {
97
-
96
+
98
97
CATCH {
99
98
default { .Str.say; }
100
99
}
101
-
100
+
102
101
die "something went wrong ...";
103
-
102
+
104
103
}
105
-
104
+
106
105
say "Hi! I am at the outer block!";
107
-
106
+
108
107
Output:
109
108
110
109
Hi! I am at the outer block!
You can’t perform that action at this time.
0 commit comments