Does Go have lambda expressions or anything similar?

前端 未结 6 1776
青春惊慌失措
青春惊慌失措 2020-12-08 03:36

Does Go support lambda expressions or anything similar?

I want to port a library from another language that uses lambda expressions (Ruby).

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 04:34

    Lambda expressions are also called function literals. Go supports them completely.

    See the language spec: http://golang.org/ref/spec#Function_literals

    See a code-walk, with examples and a description: http://golang.org/doc/codewalk/functions/

提交回复
热议问题