# 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 |

- Variadic Functions ranks in the top 50% of entities I track
- the Variadic Functions wikipedia page
- I have 15 facts about Variadic Functions. what would you like to know? 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 July 8th, 2019