Functions in R are reusable blocks of code that take inputs, perform actions, and return results. You define functions using the function()
keyword.
function()
to create a functionreturn()
to send back a value (optional — R will return the last evaluated expression if you skip it)function(name = "Guest")
.