| 1 |
= The else Statement |
| 2 |
|
| 3 |
.Syntax |
| 4 |
[source,unlang] |
| 5 |
---- |
| 6 |
if (condition) { |
| 7 |
[ statements ] |
| 8 |
} |
| 9 |
else { |
| 10 |
[ statements ] |
| 11 |
} |
| 12 |
---- |
| 13 |
|
| 14 |
An xref:if.adoc[if] statement can have an `else` clause. If _condition_ |
| 15 |
evaluates to `false`, the statements in the xref:if.adoc[if] subsection are skipped |
| 16 |
and the statements within the `else` subsection are executed. |
| 17 |
|
| 18 |
.Example |
| 19 |
[source,unlang] |
| 20 |
---- |
| 21 |
if (&User-Name == "bob") { |
| 22 |
reject |
| 23 |
} |
| 24 |
else { |
| 25 |
ok |
| 26 |
} |
| 27 |
---- |
| 28 |
|
| 29 |
// Copyright (C) 2020 Network RADIUS SAS. Licenced under CC-by-NC 4.0. |
| 30 |
// Development of this documentation was sponsored by Network RADIUS SAS. |