How to code a limit switch to a catapult

no matter what I try I can’t seem to code a limit switch to make the catapult spin till it hits the limit switch then when I click a button it shoots and resets back down to the limit switch.

What a pleasant coincidence!
image

so that’s the thing I went through that post and I put that code into my code but it wouldn’t run

i’ve tried that no luck on it working

Can you share your code?

after some logic I figured it out I had to set it as an
if
else if
else
statement to make it work