Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Variadic Functions

Variadic Functions

Variadic Functions are a feature.

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

Languages with Variadic Functions include C, PHP, Go, Slope, Jule

Example from C:
double average(int count, ...) { // }
Example from PHP:
function sum(...$nums) { return array_sum($nums); } echo sum(1, 2, 3); // 6
Example from Go:
// This variadic function takes an arbitrary number of ints as arguments. func sum(nums { 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 Slope:
(lambda (...) (apply + ...))
Example from Jule:
fn average(x: ...f64) f64 { // ... }
statements-feature.html 路 variadic-functions-feature.html 路 union-types-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub