Skip to content

Functions

Witherbear edited this page Mar 10, 2023 · 1 revision

Functions

Functions are code that can be executed. A example of functions is the main function. In the DonutScript programs, we can or not use functions. Here's a example of a function:

fun main():
   println("is a functionnnn")
end

Arguments

Functions can have arguments. Arguments are variables that functions have stored, but without any data. Example:

-- arguments can also be printed in console
fun simplefunc(arg):
   println(arg)
end

Using Functions

To use functions, we just type the name of function and the "()":

-- we can define arguments using functions
simplefunc("argument1")
Clone this wiki locally