Functions name a calculation so the same logic can be called with different inputs.

Program

Play the script to follow a subtotal into a function call and back out as a taxed total.

functions.R
add_tax <- function(price) {
  price * 1.08
}
subtotal <- 25
total <- add_tax(subtotal)
cat(total, "\n", sep = "")
function `function(price) { ... }` creates a reusable calculation.
argument The call `add_tax(subtotal)` passes the current subtotal as `price`.
return value The last expression in this function becomes the returned value.