Questioning coding 101. I've come to dislike "else" statements in #rstats or other code. It tends to require you to scroll up to figure out what the "if" is and then puzzle over what "else" means.
I generally prefer a default followed by an "if" or a couple of ifs. Thoughts?
29
9
80
As I recall, @JennyBryan made a pretty compelling case for this pattern of 'default first, if to modify' at useR! in Brisbane. Always having a default value is good.
And sometimes the crispness of
foo <- if (cond) value else othervalue
is nice too in #Rstats. Use either :)
Mar 30, 2022 · 2:59 PM UTC
2
2
20



