txt: ## add.md
  add
  
  Combined from primary sources listed below.
  
  # [In BagHash](#___top "go to top of document")[§](#(BagHash)_method_add "direct link")
  
  See primary documentation
  [in context](/type/BagHash#method_add)
  for **method add**.
  
  ```raku
  method add(BagHash: \to-add, *%_ --> Nil)
  ```
  
  When `to-add` is a single item, `add` inserts it into the `BagHash` or, if it was already present, increases its weight by 1. When `to-add` is a [`List`](/type/List), [`Array`](/type/Array), [`Seq`](/type/Seq), or any other type that `does` the [`Iterator`](/type/Iterator) Role, `add` inserts each element of the [`Iterator`](/type/Iterator) into the [`SetHash`](/type/SetHash) or increments the weight of each element by 1.
  
  *Note:* Added in version 2020.02.
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_add "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#method_add)
  for **method add**.
  
  ```raku
  method add(IO::Path:D: Str() $what --> IO::Path:D)
  ```
  
  Concatenates a path fragment to the invocant and returns the resultant `IO::Path`. If adding `../` to paths that end with a file, you may need to call [resolve](/routine/resolve) for the resultant path to be accessible by other `IO::Path` methods like [dir](/routine/dir) or [open](/routine/open). See also [sibling](/routine/sibling) and [parent](/routine/parent).
  
  ```raku
  "foo/bar".IO.mkdir;
  "foo/bar".IO.add("meow")    .resolve.relative.say; # OUTPUT: «foo/bar/meow␤»
  "foo/bar".IO.add("/meow")   .resolve.relative.say; # OUTPUT: «foo/bar/meow␤»
  "foo/bar".IO.add("meow.txt").resolve.relative.say; # OUTPUT: «foo/bar/meow.txt␤»
  "foo/bar".IO.add("../meow") .resolve.relative.say; # OUTPUT: «foo/meow␤»
  "foo/bar".IO.add("../../")  .resolve.relative.say; # OUTPUT: «.␤»
  
  method add(IO::Path:D: *@parts --> IO::Path:D)
  ```
  
  As of release 2021.07 of the Rakudo compiler, it is also possible to specify multiple parts to be added to a path.
  
  ```raku
  "foo".IO.add(<bar baz>).resolve.relative.say;      # OUTPUT: «foo/bar/baz␤»
  ```
  