Clarity theorytheory 0/50 · 0%
Functions · easy

16. Read-only Functions (define-read-only)

Querying state without changing it.

Read-only functions can look at variables and maps but cannot perform any state-changing operations like `var-set` or `map-set`.

clarity
(define-read-only (get-count)
  (var-get count))

Check your understanding

  1. 1. Can a read-only function change a map entry?