Skip to content

Commit

Permalink
Indicate Nil/Failure are exempt from return constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Sep 15, 2016
1 parent 5f8fb85 commit 417fbfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/Language/functions.pod6
Expand Up @@ -187,6 +187,12 @@ Attempting to return values of another type will cause a compilation error.
sub foo() returns Int { "a"; }; foo; # Type check fails
Note that C<Nil> and C<Failure> are excempt from return type constraints and
can be returned from any routine, regardless of its constraint:
sub foo() returns Int { fail }; foo; # Failure returned
sub foo() returns Int { return }; foo; # Nil returned
=head2 X<Multi-dispatch|declarator,multi>
Perl 6 allows you to write several routines with the same name, but different
Expand Down

0 comments on commit 417fbfe

Please sign in to comment.