summaryrefslogtreecommitdiffstats
path: root/doc/antora/modules/unlang/pages/else.adoc
blob: a795d0e12c1f6a0c2c63ebee2ae25a9f087ad0ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
= The else Statement

.Syntax
[source,unlang]
----
if (condition) {
    [ statements ]
}
else {
    [ statements ]
}
----

An xref:if.adoc[if] statement can have an `else` clause. If _condition_
evaluates to `false`, the statements in the xref:if.adoc[if] subsection are skipped
and the statements within the `else` subsection are executed.

.Example
[source,unlang]
----
if (&User-Name == "bob") {
    reject
}
else {
    ok
}
----

// Copyright (C) 2020 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
// Development of this documentation was sponsored by Network RADIUS SAS.