user17144
user17144

Reputation: 438

Rstudio debugger exits debugging mode as soon as a value is checked

I am trying to debug a simple program with the help of the Rstudio debugger. I first ran the program without the debugger. I then set a breakpoint as I have shown below, and checked "Source on Save". Then I saved the file, and the control came and halted at the breakpoint. I hit F10, typed b in the console, and got the value of b. I hit F10 again, and typed c in the console expecting to see the value of c. But, instead, Rstudio exited the debugger mode. Can someone explain what is happening?

enter image description here

Upvotes: 1

Views: 39

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 388862

The c command while using interactive debugging has a special meaning. It is used to continue the normal execution of the function.

Similarly n is to execute the next line in the function, s is used to step into the function etc. So even these variables would behave differently if you use them as variables.

To get the contents of "c" variable you can use print(c) instead in the console.

Upvotes: 2

Related Questions