"reference to undefined label" error during compilation - General - Algorand

“reference to undefined label” error during compilation

post by xonack on Aug 4, 2021

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

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

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?

Cheers!


post by Maugli on Aug 5, 2021

instead, write bnz valid_arg


Related topics

Topic Replies Views Activity
Unable to build teal files for looping conditions 1 343 Jul 2022
Can i use ‘bz’ and ‘return’ in stateless smart contract 1 337 Aug 2021
Logic eval error: stack underflow in bnz 2 529 Mar 2022
0d4efa38-d8af-445a-a45a-4b886bdcc68e.teal: logicsig program size too large: 147 > 0 6 931 Nov 2021
Passing in parameters into teal programs: type error 3 517 Nov 2019