Clarity theorytheory 0/50 · 0%
Functions · easy

15. Public Functions (define-public)

Functions callable by users and other contracts.

Public functions can be called by anyone via a transaction. They must return a `response` type (`ok` or `err`).

clarity
(define-public (increment)
  (begin
    (var-set count (+ (var-get count) u1))
    (ok (var-get count))))

Check your understanding

  1. 1. What must a public function return?