Skip to content

Commit 2993363

Browse files
committed
docs: update Syntax.md and While.md pages
1 parent f6fcc1c commit 2993363

2 files changed

Lines changed: 32 additions & 18 deletions

File tree

docs/syntax.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
## Introduction
44

55
This page is about the ZX BASIC language syntax. It is part of the Language Reference Guide.
6-
ZX BASIC aims to be a modern BASIC dialect but tries to keep some (many) of the original Sinclair BASIC features for the nostalgic. So you can use it in both ways.
6+
ZX BASIC aims to be a modern BASIC dialect but tries to keep some (many) of the original Sinclair BASIC
7+
features for the nostalgic. So you can use it in both ways.
78

8-
The BASIC dialect is mainly based in [FreeBasic](http://www.zxbasic.net/wiki/). Many of the language specifications have been taken from there.
9+
The BASIC dialect is mainly based in [FreeBasic](https://www.freebasic.net/wiki/DocToc).
10+
Many of the language specifications have been taken from there.
911

1012
## ZX BASIC syntax overview
1113

12-
If you have ever programmed in legacy BASIC (either Sinclair BASIC or any other flavour) you will already know that BASIC languages are **line oriented**. Each sentence or group of sentences are separated in lines (ended with a carriage return).
14+
If you have ever programmed in legacy BASIC (either Sinclair BASIC or any other flavour) you will already know that
15+
BASIC languages are **line oriented**. Each sentence or group of sentences are separated in lines (ended with a
16+
carriage return).
1317

14-
Nowadays this is not necessary, but ZX BASIC allows you to use lines and line numbers for compatibility (and nostalgic!) reasons:
18+
Nowadays this is not necessary, but ZX BASIC allows you to use lines and line numbers for compatibility
19+
(and nostalgic!) reasons:
1520

1621
```basic
1722
10 REM This is a comment.
@@ -52,7 +57,9 @@ PRINT _
5257

5358
### Sentences and block of sentences
5459

55-
A sentence is the simplest BASIC instruction (e.g. **[PRINT](print.md)**). Sentences might contain ''arguments'' and can be separated by a ''colon'' (:) as in Sinclair BASIC or by ''end of line''. A ''block of sentences'' are just a group of sentences one after another. Usually the reserved word **END** denotes the end of such block. E.g.
60+
A sentence is the simplest BASIC instruction (e.g. **[PRINT](print.md)**). Sentences might contain ''arguments'' and
61+
can be separated by a ''colon'' (:) as in Sinclair BASIC or by ''end of line''. A ''block of sentences'' are
62+
just a group of sentences one after another. Usually the reserved word **END** denotes the end of such block. E.g.
5663

5764
```basic
5865
IF a > b THEN
@@ -61,7 +68,8 @@ IF a > b THEN
6168
END IF
6269
```
6370

64-
In the previous example, everything between **[THEN](if.md)** and **[END IF](if.md)** conforms a ''block of sentences''. Some sentences (like the shown **[IF](if.md)**) works with sentences block. They are called ''compound sentences''.
71+
In the previous example, everything between **[THEN](if.md)** and **[END IF](if.md)** conforms a ''block of sentences''.
72+
Some sentences (like the shown **[IF](if.md)**) works with sentences block. They are called ''compound sentences''.
6573

6674
### Identifiers
6775

@@ -85,7 +93,8 @@ So, `C9` hex should be written as `0C9h` or `$C9`.
8593

8694
### Comments
8795

88-
As shown in the previous examples, the ''reserved word'' **REM** is used for comments and ''remarks''. However, you can also use the single quote (') character for comments instead of **REM**:
96+
As shown in the previous examples, the ''reserved word'' **REM** is used for comments and ''remarks''.
97+
However, you can also use the single quote (') character for comments instead of **REM**:
8998

9099
```basic
91100
10 REM This is a comment
@@ -143,7 +152,8 @@ A blank space represents both blocks blank or paper. The complete list of possib
143152

144153
### Embedded color control codes
145154

146-
Sometimes, in a program, one might wish to embed colour control codes into strings for printing. This is possible using the same schema as Paul Dunn's BASIC IDE BASin.
155+
Sometimes, in a program, one might wish to embed colour control codes into strings for printing.
156+
This is possible using the same schema as Paul Dunn's BASIC IDE BASin.
147157

148158
The escape sequences for control characters are as follows:
149159

@@ -157,11 +167,15 @@ So, for example, an embedded control code for red ink would be `\{i2}`.
157167

158168
## Data types
159169

160-
ZX Basic [types](types.md) ranges from 8 to 32 bits for integer formats. It also supports floating point format (the ZX ROM 40 bits floating point from the ROM FP Calculator) and ''Fixed'' for fixed point arithmetic. See [types page](types.md) for more information.
170+
ZX Basic [types](types.md) ranges from 8 to 32 bits for integer formats. It also supports floating point format
171+
(the ZX ROM 40 bits floating point from the ROM FP Calculator) and ''Fixed'' for fixed point arithmetic.
172+
See [types page](types.md) for more information.
161173

162174
## Inline assembly
163175

164-
The Compiler supports inline assembly, starting with the ASM directive and ending with an END ASM directive. Between these two, raw z80 assembly becomes legal. This assembly data will be passed directly to the assembler as part of the compiled assembler source.
176+
The Compiler supports inline assembly, starting with the ASM directive and ending with an END ASM directive.
177+
Between these two, raw z80 assembly becomes legal. This assembly data will be passed directly to the assembler as part
178+
of the compiled assembler source.
165179

166180
Note that the rules for assembly change dramatically from standard ZX BASIC, and this mode is not for the unwary.
167181

docs/while.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
If the given _condition_ is false the first time the inner _sentences_ are _never_ executed.
55

66
## Syntax
7-
```
7+
```basic
88
WHILE expression
99
sentences
1010
END WHILE
1111
```
1212
or
1313

14-
```
14+
```basic
1515
WHILE expression
1616
sentences
1717
WEND
1818
```
1919
The first form is preferred.
2020

2121
## Examples
22-
```
23-
While a < b
24-
Let a = a + 1
25-
Poke a, 0
26-
End While
22+
```basic
23+
WHILE a < b
24+
LET a = a + 1
25+
POKE a, 0
26+
END WHILE
2727
```
2828

2929

3030
An infinite loop:
31-
```
31+
```vbnet
3232
While 1
3333
REM An infinite loop. This will issue a warning
3434
Print "Hello world!"

0 commit comments

Comments
 (0)