1// run 2 3// Copyright 2023 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7package main 8 9func foo() { 10 println("foo") 11} 12 13func main() { 14 fn := foo 15 for _, fn = range list { 16 fn() 17 } 18} 19 20var list = []func(){ 21 func() { 22 println("1") 23 }, 24 func() { 25 println("2") 26 }, 27 func() { 28 println("3") 29 }, 30} 31