Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for Sum (0.12 sec)

  1. doc/go_spec.html

    </p>
    
    <pre>
    // sum returns the sum (concatenation, for strings) of its arguments.
    func sum[T ~int | ~float64 | ~string](x... T) T { … }
    
    x := sum                       // illegal: the type of x is unknown
    intSum := sum[int]             // intSum has type func(x... int) int
    a := intSum(2, 3)              // a has value 5 of type int
    b := sum[float64](2.0, 3)      // b has value 5.0 of type float64
    HTML
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu May 02 22:43:51 GMT 2024
    - 279.6K bytes
    - Viewed (0)
Back to top