97 190 IF SCALE$="K" THEN GOSUB 430 200 IF NOT ( GOODSCALE AND TEMP>=-273.16) GOTO 260 210 PRINT'' 220 PRINT TEMP; " Celsius" 230 PRINT TEMP+273.16; " Kelvin" 240 PRINT TEMP*9/5 + 32;" Fahrenheit" 250 PRINT 260 IF GOODSCALE THEN 310 270 CLS 280 PRINT "You must follow the temperature with" 290 PRINT "the letter ""C"", ""F"" or ""K"" " 300 PRINT "and nothing else" 310 IF TEMP>=-273.16 THEN 360 320 CLS 330 PRINT "The temperature you have given is" 340 PRINT "too cold for this universe!
Try again" 350 PRINT 360 GOTO 110 370 GOODSCALE=TRUE 380 GOTO 460 390 REM CONVERT TO CELSIUS 400 TEMP=(TEMP-32)*5/9 410 GOODSCALE=TRUE 420 GOT0460 430 REM CONVERT TO CELSIUS 440 TEMP=TEMP-273.16 450 GOODSCALE=TRUE 460 RETURN Lines 430 to 460 are referred to as a ‘subroutine’, and these lines of the program can be called from line 190 by the statement GOSUB 430 . Notice that this statement does not give the reader any idea of the purpose of the subroutine. The statement RETURN at the end of the subroutine returns it to the statement after the original GOSUB statement. Compare the last program with the one that follows.
10 REM TEMPERATURE CONVERSION 20 REM JOHN A COLL 30 REM VERSION 1.0 /22 NOV 81 40 MODE 7 50 @%=&2020A 60 PRINT "ENTER THE TEMPERATURE FOLLOWED BY" 70 PRINT "THE FIRST LETTER OF THE TEMPERATURE" 80 PRINT "SCALE. e.g. 100C or 72F or 320K" 90 REPEAT