Condition Handling

I have been reading Hadley Wickham's Advanced R for a couple of weeks and I have reached the conditions section. In one of the exercises I came across this question and I could not figure out the explanation. I would be grateful if you could explain it to me a little bit:

Q. Explain the results of running this code:

withCallingHandlers(
 message = function(cnd) message("b"),
 withCallingHandlers(
  message = function(cnd) message("a"),
  message("c")
)
)
#> b
#> a
#> b
#> c

I just don't understand what are default and parent handlers and why running message(c) first triggers the message(b) than message(a) . An explanation is much appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.