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

posted by mittyri – Russia, 2019-04-28 00:23 (1496 d 10:57 ago) – Posting: # 20253
Views: 5,963

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
22,616 posts in 4,740 threads, 1,611 registered users;
15 visitors (0 registered, 15 guests [including 5 identified bots]).
Forum time: 11:21 CEST (Europe/Vienna)

Nerds don’t just happen to dress informally.
They do it too consistently.
Consciously or not, they dress informally
as a prophylactic measure against stupidity.    Paul Graham

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