Source file test/closure6.go

     1  // compile
     2  
     3  // Copyright 2020 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  
     7  package p
     8  
     9  type Float64Slice []float64
    10  
    11  func (a Float64Slice) Search1(x float64) int {
    12  	f := func(q int) bool { return a[q] >= x }
    13  	i := 0
    14  	if !f(3) {
    15  		i = 5
    16  	}
    17  	return i
    18  }
    19  

View as plain text