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

posted by mittyri  – Russia, 2019-04-28 00:23 (2188 d 12:07 ago) – Posting: # 20253
Views: 8,615

Dear Detlew!

❝ Do you have the thousand sentences for me?

I have many of those, but for clarity I prefer a simplified version what was going on:

veryspecialfunction <- function(flag) {
  if (flag == 1) {
    "one"
  }
 
  if (flag == 2){
    "two"
  } 
}

Now running:
veryspecialfunction(2)
[1] "two"

veryspecialfunction(1)
# nothing here!
typeof(veryspecialfunction(1))
[1] "NULL"

Kind regards,
Mittyri

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,668 registered users;
65 visitors (0 registered, 65 guests [including 3 identified bots]).
Forum time: 12:31 CEST (Europe/Vienna)

Most scientists today are devoid of ideas, full of fear, intent on
producing some paltry result so that they can add to the flood
of inane papers that now constitutes “scientific progress”
in many areas.    Paul Feyerabend

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