ligo/src/proto_alpha/lib_protocol/test/contracts/conditionals.tz

10 lines
523 B
Plaintext
Raw Normal View History

parameter (or string (option int));
storage string;
code { CAR; # Access the storage
IF_LEFT {} # The string is on top of the stack, nothing to do
{ IF_NONE { FAIL} # Fail if None
{ PUSH int 0; CMPGT; # Check for negative number
IF {FAIL} # Fail if negative
{PUSH string ""}}}; # Push the empty string
NIL operation; PAIR} # Calling convention