Can i use 'bz' and 'return' in stateless smart contract

when i use algodClient.compile to compile teal with ‘bz’ or ‘return’. i got bad request (through purestake)

Welcome to Algorand!

bz and return require TEAL v2.
Do you have
#pragma version 2
or later
at the top of your TEAL code?

Be careful: if your code was written for TEAL version 1, you MUST NOT just add the above pragma as the resulting code would most likely be insecure. You MUST first carefully read the guidelines: Guidelines - Algorand Developer Portal In particular, you MUST most likely check the RekeyTo field.

If you are already using TEAL v2 or later:

  • Can you provide the full code (both TEAL code and code to call the API) you used?
  • Have you tried to use https://testnet.algoexplorerapi.io (no token)? Does it give the same error?
  • Have you tried to compile using goal clerk compile, e.g., in the sandbox?