Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 717
Shaheer Khan Avatar asked Nov 08 '22 11:11

Shaheer Khan


1 Answers

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.

like image 112
foxiris Avatar answered Nov 15 '22 10:11

foxiris