Custom Predicates

  • You can create your own predicates for reusability and better readability:
// SYNTAX
predicate_name :- predicate_body
// EXAMPLE
get_token_owner(OwnerAddress) :-
call_fn(hyperdapp, owner, [OwnerAddress]).
prompt :-
get_token_owner(OwnerAddress),
show [
text('Welcome ', OwnerAddress)
].
The output value of theownermethod is stored in the OwnerAddressvariable. To expose this value outside of your predicate, we just need to add it as an input.