RENUM
This page was last modified 12:45, 19 May 2020 by Gdx. Based on work by NYYRIKKI and Mars2000you and others.

Contents

Effect

Renumbers the lines of a program in memory, including all references to these lines by GOSUB, GOTO, etc.

The renumbered value is based on the new line number which has been changed due to the re-ordering. If a non-existing line number is recognized the error "Undefined line XX in YY" is raised. So, it can be a way to find errors in your program.

Syntax

RENUM <NewLineNumber>,<CurrentLineNumber>,<Increment>

Parameters can not end with a comma alone.

Parameters

<NewLineNumber> specifies the line number that will be used as first number in the renumbered part of your program. it is a number between 0 and 65529. (10 by default)

<CurrentLineNumber> specifies the current line number from which renumbering should start.

When this parameter is not specified, the default line number corrresponds to the first line of your program.

If you specify a current line number than the new line number must be greater than any of the line numbers that will not be renumbered. In other words, RENUM cannot be used to change the order of the program.

If you specify an old line number that does not exist, RENUM will be executed from the first line number that he will find after the non-existing line number.

<Increment> is a number between 0 and 65529. When it is not specified, the lines of your program will be incremented in steps of 10.

Examples

Assuming the following program for all of the examples:

12 PRINT "HELLO"
34 PRINT "WORLD"
56 GOTO 12
RENUM
LIST

10 PRINT "HELLO"
20 PRINT "WORLD"
30 GOTO 10
RENUM 100
LIST

100 PRINT "HELLO"
110 PRINT "WORLD"
120 GOTO 100
RENUM 0,,1
LIST

0 PRINT "HELLO"
1 PRINT "WORLD"
2 GOTO 0
RENUM 20,34
LIST

12 PRINT "HELLO"
20 PRINT "WORLD"
30 GOTO 12

Related to

AUTO, DELETE, ELSE, LIST, LLIST

Compatibility

MSX-BASIC 1.0 or higher