Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 439 Bytes

exercise.md

File metadata and controls

26 lines (17 loc) · 439 Bytes

Functions 101

Objectives

  1. Define a function that gets two integers, adds them and returns the result

    1. Make sure to also write code that executes the function
  2. What is the problem with the following code? How to fix it?

package main
        
import "fmt"

func add(x, y int) {
    return x + y
}

func main() {
    fmt.Println("Result:", add(2, 3))
}

Solution

Click here to view the solution.