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

posted by mittyri – Russia, 2019-04-27 22:23 (955 d 20:37 ago) – Posting: # 20253
Views: 5,417

(edited by mittyri on 2019-04-27 23:47)

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:

Activity
 Admin contact
21,788 posts in 4,557 threads, 1,548 registered users;
online 12 (0 registered, 12 guests [including 5 identified bots]).
Forum time: Wednesday 18:01 CET (Europe/Vienna)

There is no adequate defense, except stupidity,
against the impact of a new idea.    Percy Williams Bridgman

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