Functions
normal functions(single and multiple return), variadic functions, anonymous functions
Syntax:
func name_of_func(first, two) return_type{
return variable
}Takes two input integer and returns an integer (common int type input if both are the same type else individually)
package main
import (
"fmt"
)
func plus(a ,b int) int{
return a + b
}
func main() {
r := plus(3,4)
fmt.Println(r)
}Multiple return from function
Question: you can also pass list
Answer:
Multiple Arguments passing and receiving
Functions examples

Closures
anonymous functions
closures
Recursion
Last updated
Was this helpful?