Skip to content
Quiz · Functions as values · lesson 2 of 12

Quiz — first-class functions

What does the program print?

GO
package main

import "fmt"

func main() {
    op := func(a, b int) int { return a + b }
    r := op(2, 3)
    op = func(a, b int) int { return a * b }
    fmt.Println(r, op(2, 3))
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way