Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

310 RETURN Purpose The word RETURN – not the key marked RETURN – is used in a program a the end of a subroutine to make the computer return to the place in the program which originally ‘called’ the subroutine. See GOSUB for more details. There may be more than one RETURN statement in a subroutine – but preferably there should be one entry point and one ( RETURN ) exit point. You should try very hard to avoid leaving a subroutine with GOTO – you should always exit with RETURN . Why? Well you will soon discover in reasonable sized programs that you can get into an awful tangle and lose track of how a program works if you make the program jump all over the place.

The importance of dividing your programs into clearly defined sections wherever possible, with one entry point and one exit point, cannot be over emphasised. Examples 200 RETURN 300 IF X>4 THEN RETURN Description A statement which causes the program to branch to the statement after the one which contained the GOSUB which called the current subroutine. Syntax RETURN Associated keywords GOSUB , ON GOSUB