OneBite.Dev - Coding blog in a bite size

declare a void function without return value in R

Code snippet on how to declare a void function without return value in R

  foo <- function() {
    # Code inside the function
  }

This piece of code creates a void function in R without return value. The first line is the function header which includes the function name and its arguments in parentheses. In this case, we do not include any argument, so the parentheses are left empty. The arrow operator followed by the function body, which is wrapped in curly brackets. This is the code we want to execute when the function is called. In this case, the function does not return any value, so the body is empty.

r