Dear Bert, THanks a lot! I don't know how I escaped such a simple reasoning...
Your sincerely, AKSHAY M KULKARNI ________________________________ From: Bert Gunter <bgunter.4...@gmail.com> Sent: Thursday, June 23, 2022 12:51 AM To: akshay kulkarni <akshay...@hotmail.com> Cc: R help Mailing list <r-help@r-project.org> Subject: Re: [R] inconsistency in tryCatch... inline On Wed, Jun 22, 2022 at 12:01 PM akshay kulkarni <akshay...@hotmail.com<mailto:akshay...@hotmail.com>> wrote: Dear members, I have the following code: > tryCatch(function() print("fred"), error = function(e) sum(1:3), finally = sum(1:3)) function() print("fred") The expected output from the tryCatch call should be to print "fred" to the console, NO! You have simple defined the function -- you have not called/executed it. This defines and calls it: > tryCatch({function() print("fred")}(), error = function(e) sum(1:3), finally > = sum(1:3)) [1] "fred" Cheers, Bert and exit, but as seen above, it is outputting function() print("fred") Can you people please shed some light on what is happening? thanking you, Yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.