0

I have an If statement that looks like this:

if (condition1 == "True" && condition2 == "True" && condition3 == "True" && condition4 == "True")

Instead of having to change every value during debugging, is it possible to automatically change the value of condition1 to condition4 to "True" when the breakpoint's hit?

I just want the debugger to enter the If statement even though the conditions aren't met. It's a pain in the butt to edit every value once the If statement's hit.

1
  • 1
    Rather, once the debugger hits the breakpoint on the If statement, you can just forcefully drag and drop the cursor (yellow arrow in the left) directly inside the if block. It doesn't matter, even if the condition fails. Commented Aug 17, 2021 at 14:42

1 Answer 1

3

The simplest solution would most probably be to Change the execution flow while debugging.

With the debugger paused on a line of code, use the mouse to grab the yellow arrow pointer on the left. Move the yellow arrow pointer to a different point in the code execution path. Then you use F5 or a step command to continue running the app.

Move the execution pointer

By changing the execution flow, you can do things like test different code execution paths or rerun code without restarting the debugger.

This enables you to set a breakpoint on the if-statement, and drag execution into the if whenever necessary. This way you don't even have to change variables, but you can simply decide to execute the statement(s) inside the if-statement whenever you want to test them.

Alternatively, look at how you can Observe a single variable or expression with QuickWatch and change the value for the variable(s) there.

The QuickWatch dialog

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.