- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for ExampleIndexFunc (0.19 sec)
-
src/slices/example_test.go
// true } func ExampleIndex() { numbers := []int{0, 42, 8} fmt.Println(slices.Index(numbers, 8)) fmt.Println(slices.Index(numbers, 7)) // Output: // 2 // -1 } func ExampleIndexFunc() { numbers := []int{0, 42, -10, 8} i := slices.IndexFunc(numbers, func(n int) bool { return n < 0 }) fmt.Println("First negative at index", i) // Output: // First negative at index 2 }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 10 17:28:50 UTC 2024 - 8.1K bytes - Viewed (0)