Skip to content

Commit 72ca005

Browse files
committed
docs: update if.md page
1 parent 52b904d commit 72ca005

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

docs/if.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
**IF** is a very powerful control flow sentence that allows you to _make decisions_ under specified conditions.
44

55
## Syntax
6-
```
7-
IF expression [THEN] sentences [: END IF]
86

7+
```basic
8+
IF expression [THEN] sentences [: END IF]
99
```
10+
1011
or
1112

12-
```
13+
```vbnet
1314
IF expression [THEN]
1415
sentences
1516
[ELSEIF expression [THEN] sentences]
@@ -19,15 +20,17 @@ or
1920
END IF
2021

2122
```
23+
2224
### Examples
23-
```
25+
26+
```basic
2427
IF a < 5 THEN PRINT "A is less than five" ELSE PRINT "A is greater than five"
2528
```
2629

2730

2831
Sentences might be in multiple lines:
2932

30-
```
33+
```vbnet
3134
If a < 5 Then
3235
Print "A is less than five"
3336
a = a + 5
@@ -37,8 +40,10 @@ End If
3740
```
3841

3942

40-
Since **IF** is a _sentence_, it can be nested; however, remember that _every_ **IF** _must be closed with_ **END IF** when the line is split after **THEN** (mutiline **IF**):
41-
```
43+
Since **IF** is a _sentence_, it can be nested; however, remember that _every_ **IF** _must be closed with_
44+
`END IF` when the line is split after **THEN** (mutiline **IF**):
45+
46+
```vbnet
4247
If a < 5 Then
4348
Print "A is less than five"
4449
If a > 2 Then
@@ -57,7 +62,7 @@ End If
5762
In the example above, you see that nesting an **IF** inside another one could be somewhat verbose and error prone. It's better to use
5863
the **ELSEIF** construct. So the previous example could be rewritten as:
5964

60-
```
65+
```vbnet
6166
If a < 5 Then
6267
Print "A is less than five"
6368
If a > 2 Then

0 commit comments

Comments
 (0)