Go code
func double(number int) int {
return number * 2
}
fmt.Println(double(4))Line-by-line explanation
- Func begins the definition.
- Number is an int parameter.
- The second int is the return type.
- Return sends the calculation back.
- The call passes 4.
Expected output
8This is the expected result.