txt: ## die.md
  die
  
  Combined from primary sources listed below.
  
  # [In Exception](#___top "go to top of document")[§](#(Exception)_routine_die "direct link")
  
  See primary documentation
  [in context](/type/Exception#routine_die)
  for **routine die**.
  
  ```raku
  multi  die()
  multi  die(*@message)
  multi  die(Exception:D $e)
  method die(Exception:D:)
  ```
  
  Throws a fatal `Exception`. The default exception handler prints each element of the list to [`$*ERR`](/language/variables#index-entry-%24%2AERR) (STDERR).
  
  ```raku
  die "Important reason";
  
  ```
  
  If the subroutine form is called without arguments, the value of [`$!` variable](/syntax/$!) is checked. If it is set to a [`.DEFINITE`](/language/mop#DEFINITE) value, its value will be used as the `Exception` to throw if it's of type `Exception`, otherwise, it will be used as payload of [`X::AdHoc`](/type/X/AdHoc) exception. If `$!` is not `.DEFINITE`, [`X::AdHoc`](/type/X/AdHoc) with string `"Died"` as payload will be thrown.
  
  `die` will print by default the line number where it happens
  
  ```raku
  die "Dead";
  # OUTPUT: «(exit code 1) Dead␤
  # in block <unit> at /tmp/dead.raku line 1␤␤»
  
  ```
  
  However, that default behavior is governed at the `Exception` level and thus can be changed to anything we want by capturing the exception using `CATCH`. This can be used, for instance, to suppress line numbers.
  
  ```raku
  CATCH {
    default {
      .payload.say
    }
  };
  die "Dead" # OUTPUT: «Dead␤»
  
  ```
  