Skip to content

Commit 2cdbfe2

Browse files
committed
Rearranges examples in closes, rephrases and reindents.
1 parent b56071b commit 2cdbfe2

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

doc/Type/IO/Handle.pod6

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,17 @@ Defined as:
812812
method close(IO::Handle:D: --> Bool:D)
813813
multi sub close(IO::Handle $fh)
814814
815-
Closes an open filehandle. It's not an error to call C<close> on an
816-
already-closed filehandle. Returns C<True> on success. If you close
817-
one of the standard filehandles (by default: C<$*IN>, C<$*OUT>, or C<$*ERR>),
818-
that is any handle with L<native-descriptor|/routine/native-descriptor> C<2> or lower, you won't be
819-
able to re-open such a handle.
815+
Closes an open filehandle, returning C<True> on success, and not erroring if the
816+
filehandle is already closed, although if you close one of the standard
817+
filehandles (by default: C<$*IN>, C<$*OUT>, or C<$*ERR>), that is any handle
818+
with L<native-descriptor|/routine/native-descriptor> C<2> or lower, you won't be
819+
able to re-open them.
820+
821+
=for code
822+
given "foo/bar".IO.open(:w) {
823+
.spurt: "I ♥ Raku!";
824+
.close;
825+
}
820826
821827
It's a common idiom to use L«C<LEAVE> phaser|/language/phasers#LEAVE» for
822828
closing the handles, which ensures the handle is closed regardless of how the
@@ -838,11 +844,6 @@ sub do-stuff-with-the-file (IO $path-to-file) {
838844
839845
# ... do stuff with the file
840846
}
841-
842-
given "foo/bar".IO.open(:w) {
843-
.spurt: "I ♥ Raku!";
844-
.close;
845-
}
846847
=end code
847848
848849
B<Note:> unlike some other languages, Raku does not use reference counting,

0 commit comments

Comments
 (0)