txt: ## put.md
  put
  
  Combined from primary sources listed below.
  
  # [In IO::Handle](#___top "go to top of document")[§](#(IO::Handle)_method_put "direct link")
  
  See primary documentation
  [in context](/type/IO/Handle#method_put)
  for **method put**.
  
  ```raku
  multi method put(**@text --> True)
  multi method put(Junction:D --> True)
  ```
  
  Writes the given `@text` to the handle, coercing any non-[`Str`](/type/Str) objects to [`Str`](/type/Str) by calling [`.Str`](/routine/Str) method on them, and appending the value of [`.nl-out`](/type/IO/Handle#method_nl-out) at the end. [`Junction`](/type/Junction) arguments [autothread](/language/glossary#Autothreading) and the order of printed strings is not guaranteed.
  
  Attempting to call this method when the handle is [in binary mode](/type/IO/Handle#method_encoding) will result in [`X::IO::BinaryMode`](/type/X/IO/BinaryMode) exception being thrown.
  
  ```raku
  my $fh = 'path/to/file'.IO.open: :w;
  $fh.put: 'some text';
  $fh.close;
  
  ```
  
  # [In role IO::Socket](#___top "go to top of document")[§](#(role_IO::Socket)_method_put "direct link")
  
  See primary documentation
  [in context](/type/IO/Socket#method_put)
  for **method put**.
  
  ```raku
  method put(IO::Socket:D: Str(Cool) $string)
  ```
  
  Writes the supplied string, with a `\n` appended to it, to the socket, thus sending it to other end of the connection.
  
  Fails if the socket is not connected.
  
  # [In Proc::Async](#___top "go to top of document")[§](#(Proc::Async)_method_put "direct link")
  
  See primary documentation
  [in context](/type/Proc/Async#method_put)
  for **method put**.
  
  ```raku
  method put(Proc::Async:D: \x, |c)
  ```
  
  Does a `.join` on the output, adds a newline, and calls `.print` on it. Will throw if it's not started, or not open for writing.
  
  # [In Mu](#___top "go to top of document")[§](#(Mu)_method_put "direct link")
  
  See primary documentation
  [in context](/type/Mu#method_put)
  for **method put**.
  
  ```raku
  multi method put(--> Bool:D)
  ```
  
  Prints value to `$*OUT`, adding a newline at end, and if necessary, stringifying non-[`Str`](/type/Str) object using the `.Str` method.
  
  ```raku
  "abc".put;              # OUTPUT: «abc␤»
  ```
  
  # [In Independent routines](#___top "go to top of document")[§](#(Independent_routines)_sub_put "direct link")
  
  See primary documentation
  [in context](/type/independent-routines#sub_put)
  for **sub put**.
  
  ```raku
  multi put()
  multi put(**@args --> True)
  multi put(Junction:D --> True)
  multi put(Str:D \x)
  multi put(\x)
  ```
  
  Same as [`print`](/type/independent-routines#sub_print), except it uses [`print-nl`](/routine/print-nl) (which prints a [newline](/language/newline), by default) at the end. [`Junction`](/type/Junction) arguments [autothread](/language/glossary#Autothreading) and the order of printed strings is not guaranteed.
  
  ```raku
  put "Hi there!\n";   # OUTPUT: «Hi there!␤␤»
  put "Hi there!";     # OUTPUT: «Hi there!␤»
  put [1, 2, 3];       # OUTPUT: «1 2 3␤»
  put "Hello" | "Goodbye"; # OUTPUT: «Hello␤Goodbye␤»
  ```
  
  By itself, `put()` will print a new line
  
  ```raku
  put "Hey"; put(); put("Hey"); # OUTPUT: «Hey␤␤Hey␤»
  ```
  
  but please note that we have used parentheses after `put`. Without these parentheses, it will throw an exception (with version 6.d and after). It will also raise an exception if it's used that way before `for`; use the method form `.put` instead.
  
  ```raku
  .put for <1 2 3>;             # OUTPUT: «1␤2␤3␤»
  ```
  