5 Halloween Cocktails That Are Easy to Serve at Your 2026 Bash
Mix five vivid, approachable Halloween cocktails with measured recipes, simple prep tips, and an alcohol-free option for your party guests.
Variadic functions in Go allow you to pass a variable number of arguments to a function. This is useful when you don't know in advance how many arguments you will pass. A variadic function in Golang accepts multiple arguments of the same type and can be called with any number of arguments, including none.

package main
import "fmt"
// Hàm Variadic tính tổng
func sum(nums ...int) int {
total := 0
for _, n := range nums {
total += n
}
return total
}
func main() {
fmt.Println("Sum of 1, 2, 3:", sum(1, 2, 3))
fmt.Println("Sum of 4, 5:", sum(4, 5))
fmt.Println("Sum of no numbers:", sum())
}
Result:
Sum of 1, 2, 3: 6
Sum of 4, 5: 9
Sum of no numbers: 0
Syntax:
func functionName(parameters ...Type) ReturnType {
// Code
}
In the above syntax:
parameters ...Typeindicates that the function can accept a variable number of arguments of type Type.How to use uncertain functions in Golang
When defining a variadic function, you specify the argument types followed by an ellipsis (...) as in the example above. Inside the function, these arguments can be thought of as a slice.
You can call a variadic function with any number of arguments, including zero. The function treats the arguments as a slice.
For example:
package main
import "fmt"
func sum(nums ...int) int {
total := 0
for _, n := range nums {
total += n
}
return total
}
func main() {
fmt.Println("Sum of 1, 2, 3:", sum(1, 2, 3))
fmt.Println("Sum of 4, 5:", sum(4, 5))
fmt.Println("Sum of no numbers:", sum())
}
Result:
Sum of 1, 2, 3: 6
Sum of 4, 5: 9
Sum of no numbers: 0
You can also combine variadic parameters with regular parameters in a function. Variadic parameters must always be the last parameter.
For example:
package main
import "fmt"
// Hàm Variadic tính tổng
func sum(nums ...int) int {
total := 0
for _, n := range nums {
total += n
}
return total
}
// Hàm với tham số thông thường và variadic
func greet(prefix string, nums ...int) {
fmt.Println(prefix)
for _, n := range nums {
fmt.Println("Number:", n)
}
}
func main() {
greet("Sum of numbers:", 1, 2, 3)
greet("Another sum:", 4, 5)
greet("No numbers sum:")
}
Result:
Sum of numbers:
Number: 1
Number: 2
Number: 3
Another sum:
Number: 4
Number: 5
No numbers sum:
Mix five vivid, approachable Halloween cocktails with measured recipes, simple prep tips, and an alcohol-free option for your party guests.
Find 15 office-friendly Halloween costume ideas for 2026, with practical checks for dress codes, respectful themes, comfort, and workplace safety.
Plan a fun elementary school Halloween party with easy crafts, games, inclusive treats, costume tips, and a sample 75-minute classroom schedule.
Compare realistic side hustles for 2026 by startup cost, fees, flexibility, and income control, with current tax and scam guidance from official sources.
Upgrade your home office ergonomics with current OSHA and NIOSH guidance on chair fit, monitor height, laptop setup, lighting, and movement.
Learn why emotional intelligence matters in leadership, where it helps most, how to strengthen it, and how to tell whether your approach is working.
A practical roadmap for moving into tech without a degree: choose an accessible role, build job-ready skills, prove them with projects, and use hiring feedback to improve.
Build a credible LinkedIn personal brand in 2026 with current profile, content, newsletter, analytics, verification, and visibility guidance from LinkedIn.
Quiet quitting and quiet firing are catchy labels, not diagnoses. Learn what is verified, what depends on context, and what employees and managers can do next.
Fractional executives offer senior leadership without a full-time hire. Learn when the model works, what to ask, and the risks to manage.