Introduction
In this challenge, we will learn about functions in Go. We will see how to define functions, how to pass arguments to them, and how to return values from them.
In this challenge, we will learn about functions in Go. We will see how to define functions, how to pass arguments to them, and how to return values from them.
In the given code, we have two functions plus
and plusPlus
. The plus
function takes two integers as arguments and returns their sum. The plusPlus
function takes three integers as arguments and returns their sum. Your task is to complete the plusPlus
function by adding the third integer to the sum of the first two integers.
plus
function should take two integers as arguments and return their sum as an integer.plusPlus
function should take three integers as arguments and return their sum as an integer.plusPlus
function should use the plus
function to calculate the sum of the first two integers.$ go run functions.go
1+2 = 3
1+2+3 = 6
## There are several other features to Go functions. One is
## multiple return values, which we'll look at next.
In this challenge, we learned about functions in Go. We saw how to define functions, how to pass arguments to them, and how to return values from them. We also saw how to use one function inside another function.