Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleClone (0.2 sec)

  1. src/slices/example_test.go

    	slices.SortStableFunc(people, func(a, b Person) int {
    		return strings.Compare(a.Name, b.Name)
    	})
    	fmt.Println(people)
    	// Output:
    	// [{Alice 20} {Alice 55} {Bob 24} {Gopher 13}]
    }
    
    func ExampleClone() {
    	numbers := []int{0, 42, -10, 8}
    	clone := slices.Clone(numbers)
    	fmt.Println(clone)
    	clone[2] = 10
    	fmt.Println(numbers)
    	// Output:
    	// [0 42 -10 8]
    	// [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)
Back to top