Shaheer Khan
Shaheer Khan

Reputation: 51

Conditional breakpoints in VScode trip even when condition is false

Like the title said, any conditional breakpoints I set in VS code are always tripped, even when the condition is false. I right-clicked in the margin, typed the condition into the little box that shows up, and hit enter. Is the syntax? I tried the following conditions and they were all tripped, even though they're obviously false.

(if False)

And this:

(False)

Using Python, if that makes any difference.

Upvotes: 5

Views: 1479

Answers (1)

foxiris
foxiris

Reputation: 3378

I fall into a pitfall,

foo1 = 1
foo2 = 2

If you want to stop when foo1 == 1, you need to set a breakpoint at line 2. At line 1, the foo1 is not defined yet.

Upvotes: 2

Related Questions