magik of R implicit return [🇷 for BE/BA]

posted by ElMaestro  – Denmark, 2019-04-28 00:34 (2262 d 09:33 ago) – Posting: # 20254
Views: 9,223

Hi all,

"smart" lost this round.

I always use explicit return(something) in my functions, when they are supposed to return a value regardless of whether it is a list, numeric, NULL or data frame some other thingy.

Yes, that involves tapping a few times more on the keyboard but it does solve a lot of problems and best of all, it makes code readable.

In language like C you would never run into this phenomenon. You declare explicitly which type the function returns and you will be bombarded with errors or warnings if you fail to return the right type of if you forget the return statement. I find it very comfortable.

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,427 posts in 4,929 threads, 1,681 registered users;
61 visitors (0 registered, 61 guests [including 17 identified bots]).
Forum time: 10:08 CEST (Europe/Vienna)

No matter what side of the argument you are on,
you always find people on your side
that you wish were on the other.    Thomas Berger

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5