Noop to do nothing

Hi Algorand community,

I am using pyteal to create a function to update a field of my smart contract.

If the new value is the same as the existing value i want the function to “pass”.

I currently created a function like this:

    def noop_partial_shipment():
        saved_partial_shipment = App.globalGet(Bytes(PARTIAL_SHIPMENT))

        return Seq(
            Assert(ASSERT SOMETHING),
            Cond(
                   # if not set
                [ saved_partial_shipment == Bytes(""), DO SOMETHING],  
                   # if values are the same, skip
                [saved_partial_shipment == Txn.application_args[1], Approve()],  # DO NOTHING
                   # if currently set to something 
                [saved_partial_shipment != Txn.application_args[1], DO SOMETHING  ]
            ),
        )

The second condition i indicated Approve() hoping for the function to just pass, but in reality the call takes few seconds and it subtract the transaction fee.

I also noticed that if i remove the second condition and this is true:

saved_partial_shipment == Txn.application_args[1]

Then the application returns an error. I imagined initially if conditions do not trigger then nothing happens but i discovered it is not the case.

In short: how do I get a noop to do something or to avoid the error in case no conditions are triggered?

Thank you

What do you mean by the “function just to pass”?
At the end of the day, the application call transaction is either approved and recorded on the chain (and the fee is paid) or rejected (and if in a group, that rejects all the group).
There is no notion of “just to pass”.

Approve is the equivalent in C of exit(0), it exits immediately and approves the transaction, stopping all other code.

Pass as in the python equivalent of:

def my_func():
     pass

that function does nothing.
Understood, thank you Fabrice