Lesson Contribution - return function
Talishask opened this issue · comments
I'm a member of The Carpentries Core Team and I'm submitting this issue on behalf of another member of the community. In most cases, I won't be able to follow up or provide more details other than what I'm providing below.
In this lesson (https://swcarpentry.github.io/r-novice-gapminder/10-functions/index.html), there is a mention of the return function. I think that more information can be included to explain the return function:
- If you do not include it will not print the final variable to the console
- The returned variable will cause the function to stop.
Thanks for passing this along, @Talishask . For now, I think the explanation of the return()
function is sufficient. I'll also note that the variable value is printed even without the return()
statement. e.g.
tiny_fun <- function(x) {
x * 2
}
tiny_fun(3)
# [1] 6