Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ExampleCopy (0.14 sec)

  1. src/maps/example_test.go

    	}
    	m4 := maps.Clone(m3)
    	fmt.Println(m4["key"][0])
    	m4["key"][0] = 100
    	fmt.Println(m3["key"][0])
    	fmt.Println(m4["key"][0])
    
    	// Output:
    	// 1
    	// 100
    	// 1
    	// 100
    	// 100
    }
    
    func ExampleCopy() {
    	m1 := map[string]int{
    		"one": 1,
    		"two": 2,
    	}
    	m2 := map[string]int{
    		"one": 10,
    	}
    
    	maps.Copy(m2, m1)
    	fmt.Println("m2 is:", m2)
    
    	m2["one"] = 100
    	fmt.Println("m1 is:", m1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 11 20:21:56 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  2. src/io/example_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package io_test
    
    import (
    	"fmt"
    	"io"
    	"log"
    	"os"
    	"strings"
    )
    
    func ExampleCopy() {
    	r := strings.NewReader("some io.Reader stream to be read\n")
    
    	if _, err := io.Copy(os.Stdout, r); err != nil {
    		log.Fatal(err)
    	}
    
    	// Output:
    	// some io.Reader stream to be read
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:49:32 UTC 2022
    - 5.5K bytes
    - Viewed (0)
Back to top