- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for ExampleReverse (0.19 sec)
-
src/sort/example_test.go
fmt.Println(sort.Float64sAreSorted(s)) s = []float64{5.2, 1.3, 0.7, 3.8, 2.6} // unsorted fmt.Println(sort.Float64sAreSorted(s)) // Output: true // false // false } func ExampleReverse() { s := []int{5, 2, 6, 3, 1, 4} // unsorted sort.Sort(sort.Reverse(sort.IntSlice(s))) fmt.Println(s) // Output: [6 5 4 3 2 1] } func ExampleSlice() { people := []struct { Name string
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Aug 28 17:29:29 UTC 2017 - 2.8K bytes - Viewed (0) -
src/slices/example_test.go
names := []string{"Alice", "Bob", "Vera", "Zac"} names = slices.Replace(names, 1, 3, "Bill", "Billie", "Cat") fmt.Println(names) // Output: // [Alice Bill Billie Cat Zac] } func ExampleReverse() { names := []string{"alice", "Bob", "VERA"} slices.Reverse(names) fmt.Println(names) // Output: // [VERA Bob alice] } func ExampleSort() { smallInts := []int8{0, 42, -10, 8}
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 10 17:28:50 UTC 2024 - 8.1K bytes - Viewed (0)