print_main_data <- function() {
cat("printMainData\n")
}
print_other_data <- function() {
cat("printOtherData\n")
}
print_some_data <- function(print_all) {
print_main_data()
# Leave early with no value to print
if (!print_all) return(invisible())
print_other_data()
}
print_some_data(FALSE)
print_some_data(TRUE)
# Trap: a bare return() gives a visible NULL
stop_early <- function() {
return()
}
stop_early()
# NULL