Documentation for routine
say assembled from the following types:
multi method say(|)
multi method say(IO::Handle: ** --> True)
Attempting to call this method when the handle is in binary mode will result in
X::IO::BinaryMode exception being thrown.
my = open 'path/to/file', :w;.say(Complex.new(3, 4)); # OUTPUT: «3+4i␤».close;
From Independent routines
multi sub say(** --> True)
Prints the "gist" of given objects; it will always invoke
.gist in the case the object is a subclass of
Str. Same as
put, except it uses
.gist method to obtain string representation of the object; as in the case of
put, it will also autothread for
.gist method of some objects, such as Lists, returns only partial information about the object (hence the "gist"). If you mean to print textual information, you most likely want to use
say Range; # OUTPUT: «(Range)␤»say ; # OUTPUT: «(Foo)␤»say 'I ♥ Raku'; # OUTPUT: «I ♥ Raku␤»say 1..Inf; # OUTPUT: «1..Inf␤»
multi method say()
say 42; # OUTPUT: «42␤»
In non-sink context,
say will always return
say (1,[1,2],"foo",Mu).map: so *.say ;# OUTPUT: «1␤[1 2]␤foo␤(Mu)␤(True True True True)␤»
However, this behavior is just conventional and you shouldn't trust it for your code. It's useful, however, to explain certain behaviors.
say is first printing out in
*.say, but the outermost
say is printing the
True values returned by the
method say(Proc::Async: , : = )
gist on the
$output, adds a newline, encodes it as UTF-8, and sends it to the standard input stream of the external program, encoding it as UTF-8.
Returns a Promise that will be kept once the data has fully landed in the input buffer of the external program.
Proc::Async object must be created for writing (with
Proc::Async.new(:w, $path, @args)). Otherwise an X::Proc::Async::OpenForWriting exception will the thrown.
start must have been called before calling method say, otherwise an X::Proc::Async::MustBeStarted exception is thrown.