txt: ## val.md
  val
  
  Combined from primary sources listed below.
  
  # [In Str](#___top "go to top of document")[§](#(Str)_routine_val "direct link")
  
  See primary documentation
  [in context](/type/Str#routine_val)
  for **routine val**.
  
  ```raku
  multi val(*@maybevals)
  multi val(Slip:D \maybevals)
  multi val(List:D \maybevals)
  multi val(Pair:D \ww-thing)
  multi val(\one-thing)
  multi val(Str:D $MAYBEVAL, :$val-or-fail)
  ```
  
  Given a `Str` that may be parsable as a numeric value, it will attempt to construct the appropriate [allomorph](/language/glossary#Allomorph), returning one of [`IntStr`](/type/IntStr), [`NumStr`](/type/NumStr), [`RatStr`](/type/RatStr) or [`ComplexStr`](/type/ComplexStr) or a plain `Str` if a numeric value cannot be parsed.
  
  ```raku
  say val("42").^name;    # OUTPUT: «IntStr␤»
  say val("42e0").^name;  # OUTPUT: «NumStr␤»
  say val("42.0").^name;  # OUTPUT: «RatStr␤»
  say val("42+0i").^name; # OUTPUT: «ComplexStr␤»
  ```
  
  You can use the plus and minus sign, as well as the Unicode "Minus Sign" as part of the String
  
  ```raku
  say val("−42");         # OUTPUT: «−42␤»
  ```
  
  While characters belonging to the Unicode categories `Nl` (number letters) and `No` (other numbers) can be used as numeric literals in the language, they will not be converted to a number by `val`, by design, and using `val` on them will produce a failure. The same will happen with synthetic numerics (such as 7̈ ). See [unival](/routine/unival) if you need to convert such characters to [`Numeric`](/type/Numeric).
  