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.

Subtract

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

Subtract( value_1, value_2, ... )
subtract( value_1, value_2, ... )
Subtract( value_1, value_2, ... )
Subtract( value_1, value_2, ... )
Subtract( value_1, value_2, ... )

Description

The Subtract function returns the difference of a list of numbers.

Parameters

Parameter Type Definition and Requirements

value

A list of Numbers

Take the difference of these values.

Returns

A Number which is the difference of all provided Numbers.

Examples

The following query returns the result of subtracting 10 from 100:

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

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

  •   bytesOut:  15

  • 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!