Function
Create function
getRand <- function(n)
{
	return(runif(n))
}

print(getRand(4))
		
Default parameters
getSum <- function(a = 0, b = 1, c = 2)
{
	return(a+b+c)
}

print(getSum(1, 2, 3)) # a = 1, b = 2, c = 3
print(getSum(1, 2)) # a = 1, b = 2, c = 2
print(getSum()) # a= 0, b = 1, c = 2
print(getSum(b = 10)) # pass value by parameter name, a = 0, b = 10, c = 2
		
Return multiple values
library(gsubfn)

getMul <- function()
{
	return(list(1, 2))
}

list[a, b] <- getMul()

message(sprintf("%d, %d\n", a, b))