= The group Statement

.Syntax
[source,unlang]
----
group {
    [ statements ]
}
----

The `group` statement collects a series of statements into a list.
The default processing sections of the server (`recv Access-Request`,
`send Accounting-Response %{Acct-Status-Type}`, etc.) are also `group`
statements.  Those sections are given different name for management
reasons, but they behave internally exactly like a `group`.

[ statements ]:: The `unlang` commands which will be executed.

All of the statements inside of the `group` are executed in sequence.
The `group` statement is not normally used, as the statements within
it can just be placed inside of the enclosing section.  However, the
`group` statement is included in the `unlang` syntax for completeness.

.Examples

[source,unlang]
----
group {
    sql
    ldap
    file
    if (updated) {
    ...
    }
}
----

The last entry in a `group` section can also be an xref:unlang/actions.adoc[actions] subsection.

== Grouping Edits

The `group` keyword can also be used to group multiple
xref:unlang/edit.adoc[edit] instructions.  When edit instructions are
grouped, then the edits are "atomic".  That is, either all of the
edits succeed, or none of them do.

// Copyright (C) 2021 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
// This documentation was developed by Network RADIUS SAS.
