---
title: Work with functions
description: A function type is a set of parameters that perform an operation. Learn how to work with functions in flux.
url: https://docs.influxdata.com/flux/v0/data-types/composite/function/
estimated_tokens: 948
product: Flux
version: v0
---

# Work with functions

A **function** type is a set of parameters that perform an operation.

-   [Function syntax](#function-syntax)
-   [Define functions](#define-functions)

## Function syntax

A Flux **function** literal contains the following:

-   Zero or more parameters enclosed in parentheses (`()`)
    -   Parameters are comma separated
    -   Parameters must be named (no positional params)
    -   Optionally assign a default value for each parameter with the `=` [assignment operator](/flux/v0/spec/operators/#assignment-operators). Parameters without a default value require user input and are considered **required parameters**.
-   `=>` [arrow operator](/flux/v0/spec/operators/#function-operators) to pass parameters into the function body.
-   Function body to define function operations and return a response.

##### Example functions

```js
// Function that returns the value 1
() => 1

// Function that returns the sum of a and b
(a, b) => a + b

// Function with default values
(x=1, y=1) => x * y

// Function with a block body
(a, b, c) => { 
    d = a + b
    return d / c
}
```

## Define functions

*For information about defining custom functions, see [Define custom functions](/flux/v0/define-functions/).*

#### Related

-   [Define custom functions](/flux/v0/define-functions/)

[composite types](/flux/v0/tags/composite-types/) [data types](/flux/v0/tags/data-types/)
