# Variadic Functions

Variadic Functions is an actively used design pattern. In mathematics and in computer programming, a variadic function is a function of indefinite arity, i.e., one which accepts a variable number of arguments. Support for variadic functions differs widely among programming languages.. Read more on Wikipedia...

?Years Old |

- the Variadic Functions wikipedia page
- Have a question about Variadic Functions not answered here? Email me and let me know how I can help.

Languages **with** Variadic Functions include c, go, php

### Example from c:

double average(int count, ...) { // }

### Example from go:

// This variadic function takes an arbitrary number of ints as arguments. func sum(nums ...int) { fmt.Print("The sum of ", nums) // Also a variadic function. total := 0 for _, num := range nums { total += num } fmt.Println(" is", total) // Also a variadic function. }

### Example from php:

function sum(...$nums) { return array_sum($nums); } echo sum(1, 2, 3); // 6

Last updated February 18th, 2020