"reference to undefined label" error during compilation

Hi all,

I’m creating a simple app to experiment with branching TEAL branching functionality. The approval program code is the following:

#pragma version 4

//check number of args is 1
txn NumAppArgs
int 1

// branch if 1 arg was supplied, return 1 ow
bnz valid_arg:
int 1

// return 2 if branching was successful (accept anyway)
int 2

It seems like the following error is thrown when trying to compile the code:

approval_test.teal: 7: reference to undefined label "valid_arg:"
approval_test.teal: 1 error

I’m using the Your First Application template as a reference and not sure why the branch (bnz) does not recognize the label a few lines down. Any ideas?


instead, write bnz valid_arg

1 Like