#How do we break the execution of a method in mid?

1 messages · Page 1 of 1 (latest)

old zealot
#

Hey all, how do we go about breaking the execution of a method on a smart contract and maybe return some value mid way (assuming the method returns a value) if certain condition is true?

Example :
const found : Bool = ...;
??? Provable.if(found, return Bool(true), )

pine horizon
#

there is no kind of early return available in circuits. it is a more "functional" style in that regard.

when you are using recursion, you can use verifyIf to only require a proof to verify when a condition holds. this way, when the proof isn't required for verification, you can skip generating it.