Unit 4 watcher visible

I an make a watcher but am I supposed to be a ble to read the values somewhere?

You should see the value change in the watcher panel as you run the code.

Another watcher question - if the student incorrectly declares a variable both globally and locally, which will appear in the watcher? The global variable?

I just tested it out and it showed the value at that moment. In other words while it was in the function it showed the value of the variable in the function and as soon as the function returned it went back to showing the value of the global variable.

When I test a local variable, it never shows up as available. Is there a specific way to watch local variables?

You will need to add breakpoints and step through the function or slow your program down enough so you can see the behavior inside the function.

1 Like