@william,
What do you mean by adjusting angle or distance? you can set whatever move you want to in the else statement.
If you are new to robots, you can take a look at the online UR academy training. There is a lot of useful stuff to get you started.
I have a if and else loop.This situation is if the gripper catch something,it will go to somewhere.But the gripper did not catch anything,it will use adjust angle or distance to search for something.I want to know how let UR5 adjust angle or distance when robot know it did not catch anything.THANKS!