aboutsummaryrefslogtreecommitdiff
path: root/doc/language/keyword/cpsc-keyword-if.7.md
blob: 8372c57100b462d290c28d09e92d5d7f02b6b5ce (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
31
32
33

% CPSC-KEYWORD-IF(7)

# NAME

cpsc-keyword-if, cpsc-keyword-then, cpsc-keyword-else, cpsc-keyword-endif - choose between branches

# SYNOPSIS

```text
IF condition THEN
    statements
ELSE
    statements
ENDIF
```

# DESCRIPTION

Execute the THEN branch when the condition is true, otherwise the optional ELSE branch. Blocks may be nested. THEN, ELSE, and ENDIF belong to this syntax.

# EXAMPLE

```text
IF 3 > 2 THEN
    OUTPUT "yes"
ELSE
    OUTPUT "no"
ENDIF
```

# SEE ALSO

[cpsc-language-overview(7)](../cpsc-language-overview.7.md), [cpsc-keyword-and(7)](cpsc-keyword-and.7.md), [cpsc-keyword-or(7)](cpsc-keyword-or.7.md), [cpsc-keyword-not(7)](cpsc-keyword-not.7.md).