Typically you want to ask a question about your code, not just paste a screenshot, but no matter.
Your forever loop will run, well, forever. So that driving and sensing the limit switch? The code never gets to that part. Change up how your code is structured so it doesn’t get stuck in a loop.
You could use events. This way your display is handled separately from your drive code.
if a change the forever code is to a waiting unit the limitswich is passed that work
if work but the if-then statement not works so I change the to a if then else statement but the but the if than not work but the else is working
Can you send a new screenshot of your code? Also explain what you want the code to do.
The problem here is that you are only checking if the switch is pressed once.