Clarity theorytheory 0/50 · 0%
Control Flow · easy

18. Assertions (asserts!)

Guarding against invalid states.

The `asserts!` function checks a boolean condition. If the condition is `false`, the function returns the provided error value and rolls back changes.

clarity
(asserts! (is-eq tx-sender contract-owner) (err u403))

Check your understanding

  1. 1. What happens if asserts! receives false?