Skip to content

Commit 7ed47fe

Browse files
committed
doc: add GO TO page
1 parent 77ef3fd commit 7ed47fe

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

docs/goto.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#GO TO
2+
3+
4+
##Syntax
5+
```
6+
GO TO <label>
7+
GOTO <label>
8+
```
9+
Continues (jumps) the execution at the given label or line number.
10+
11+
This sentence exists just for compatibility with legacy BASIC
12+
dialects. You should use [DO...LOOP](do.md), [FOR](for.md), [SUB](sub.md)
13+
or [FUNCTION](function.md) instead.
14+
15+
You can't GOTO into a function or sub.
16+
17+
### Example with GO TO
18+
19+
```
20+
10 GOTO 30
21+
20 END
22+
30 PRINT "This is executed before END"
23+
40 GOTO 20
24+
```
25+
26+
This will `This is executed before END` and then jump into
27+
line 20, finishing the program.
28+
29+
30+
##Remarks
31+
* This statement is Sinclair BASIC compatible.
32+
33+
##See also
34+
* [GO SUB](gosub.md)

0 commit comments

Comments
 (0)