---
title: "Comment by Lukas Gaučas on \"The Three Dots In Golang...\" | Hashnode"
description: "Nice one ! Also consider example with simple under(lying) type package main import ( . &quot;fmt&quot; ) type under int // Based on (but with underlying type) :"
url: "https://hashnode.com/posts/the-three-dots-in-golang/61177d0af6ebde51f64fa331/comment/63a241a6a59cad9bdbba38cb"
---

[Discussion](https://hashnode.com/posts/the-three-dots-in-golang/61177d0af6ebde51f64fa331)

Comment [The Three Dots In Golang...](https://hashnode.com/posts/the-three-dots-in-golang/61177d0af6ebde51f64fa331)

[Lukas Gaučas](https://hashnode.com/@projektorius96)

[Dec 20, 2022](https://hashnode.com/posts/the-three-dots-in-golang/61177d0af6ebde51f64fa331/comment/63a241a6a59cad9bdbba38cb)

Nice one ! Also consider example with simple [under(lying) type](https://replit.com/@projektorius96/purefunctions#variadic_funcs.go)

```
package main

import (
    . "fmt"
)

type under int

// Based on (but with underlying type) : @blog.harishdurga.com/the-three-dots-in-golang
// define ...rest like parameter for variadic functions
func Sum(nums ...under) under {
    var r under = 0
    for _, n := range nums {
        r += n
    }
    return under(r)
}

func main() {
    /* Println( Sum([]int{1,2,3}...) ) */// instead do:
    Println( Sum([]under{1,2,3}...) )
}
```
