Explicitly calling return in a function or not

0 votes
A while back, Simon Urbanek from the R core team (I believe) chastised me for advising a user to use return directly at the end of a function (his comment was later removed):

The formula foo = function() + return(value)
Rather, he suggested:

value = function() + foo
Probably, in this circumstance, it is necessary to:

"foo" = "function()"; "if(a)" "return(a)" "otherwise" "return(b)"
His reply clarified the benefits of not calling return unless absolutely necessary, but it was taken down.

Why doesn't calling return sooner or better, and hence be preferred?
Jul 6, 2022 in Data Science by avinash
• 1,840 points

edited 4 days ago 6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP