# fn() sum
Returns the sum of all elements in a sequence.

Defined in | <seqan/parallel.h>
Signature | `TValue sum(seq[, parallelTag]);`

## Parameters

`seq` | The sequence to sum up, o ftype `TSequence`.
`parallelTag` | Tag to enable/disable parallelism, one of `Serial` and `Parallel`, default is `Serial`.

## Return Values

`TValue` | The sum of the elements in `seq`, of type `Value<TSequence>::Type`.

## Detailed Description

The sequence alphabet must support the `operator+` and conversion from zero.

## Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## See Also

- partialSum

#### Dox Sources

    /*!
     * @fn sum
     *
     * @headerfile <seqan/parallel.h>
     *
     * @brief Returns the sum of all elements in a sequence.
     *
     * @signature TValue sum(seq[, parallelTag]);
     *
     * @param[in] seq The sequence to sum up, o ftype <tt>TSequence</tt>.
     * @param[in] parallelTag Tag to enable/disable parallelism, one of
     *                        <tt>Serial</tt> and <tt>Parallel</tt>, default is
     *                        <tt>Serial</tt>.
     *
     * @return TValue The sum of the elements in <tt>seq</tt>, of type
     *                <tt>Value&lt;TSequence&gt;::Type</tt>.
     *
     * The sequence alphabet must support the <tt>operator+</tt> and conversion from
     * zero.
     *
     * @see partialSum
     */