FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, review the migration guide. Contact support@fauna.com with any questions.

Add

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Add( value_1, value_2, ... )
add( value_1, value_2, ... )
Add( value_1, value_2, ... )
Add( value_1, value_2, ... )
Add( value_1, value_2, ... )

Description

The Add function returns the sum of its numeric parameters. It can take a single value or a list of values. Providing a single number returns the number.

Parameters

Parameter Type Definition and Requirements

value

Number

One or more numbers to sum.

Returns

A number which is the sum of all values.

Examples

The following query returns the sum of 100 and 10:

client.query(
  q.Add(100, 10)
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
110
result = client.query(
  q.add(100, 10)
)
print(result)
110
result, err := client.Query(
	f.Add(100, 10))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
110
try
{
    Value result = await client.Query(
        Add(100, 10)
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
LongV(110)
Add(100, 10)
110
Query metrics:
  •    bytesIn:  16

  •   bytesOut:  16

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    retries:   0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!