With Action: How to know if statement worked properly?

I have the following with action:

With
Lock
Do
TestUnlockWithCode(1234)

How do I get back if this succeeded or failed so I can run the appropriate subsequent statements accordingly?

What I'm trying to accomplish is I'm setting a lock code within a lock. I want a way to know it was successful or not. Based on that, I can run subsequent rules accordingly.

Thanks in advance...

Which lock are you using? can you add a wait and then test if the locked state of the lock has changed?