Clarity theorytheory 0/50 · 0%
Error Handling · medium

21. Unwrap! and Unwrap-panic

Unpacking Optionals and Responses.

These functions are used to get the inner value of a `some` or `ok`. `unwrap!` returns an error on failure, while `unwrap-panic` terminates the transaction.

clarity
(let ((val (unwrap! (some u10) (err u404))))
  val)

Check your understanding

  1. 1. What does unwrap-panic do on a 'none' value?