Do you mean you want to view what is happening to the variable n in your code? When you go into debug mode, you can see the value of any variable defined inside your function, and iterate with the next key so you can see if something in your code is making it behave improper. If so, then the above instructions are meant to do just that.
If you just wanted to print the value of x and n at each iteration, then you would want to:
library(glue)
testf <- function(x){0
for(n in 1:4){
x=x+n
print(glue::glue("value of x is",{x}))
print(glue::glue("value of n is",{n}))
}
}
testf(4)
A separate, but necessary question though, is what exactly are you trying to accomplish with your function that you have defined?