Subroutines A subroutne Isa SOT! ( mini-program withina program ltcairiesoul a particular task such as adding numbers or keeping aa scote and you can "nd the computer to it whenever you want lhis task carried out This -aves writing CU! the program lines each time and makes the program 120 PRINT "LEFT AGAIN, ENTER SHOP" obet k la or. Wllo | PRINT "BUY ';X$;" COME HOME pna IE 140 computer back to line Ifyou forgetthe 40 - the hne after RETURN line you get a bug. number. The computer automatically goes back tothe instruction after the one where it left the main partof the program. ln BASIC, to tell the computer to gotoa subroutune you use the word GOSUB with the word RETURNAat the end ofthe subroutune. GOSUB should be followed by You can send the computer loa the number of the first line ofthe subroutine anywhere in the program as subroutune. RETURN does not need a line many times as you like. Conversion program 100 INPUT "DISTANCE";M — m 110 INPUT "TIME,T O... 80 PRINT "A DIVIDED BY B-";AB,. — 130 PRINT "AVERAGE SPEED WAS 9 GOTO 50 Ww 140 PRINT MT." MPH AND":K/T;" KPH" Z 350 REM: SUBROUTINE TO STOP 150 STOP /,, 260 IF AO AND B-0 THEN STOP 200 REM: SUBROUTINE TO CONVERT MILES 270 RETURN 210 LET KeMa 1609 RETURN Numbers program 50 INPUT A 60 INPUT B Circles program | Centre ofcircle < X,Y 2 Radius of circle < R 3 Colkur< X 4 Gosub 10 im 5 Gotol 10 Rem: Subroutine to draw circles This program :s in English, not BASIC, ll Draw a circle with centre X,Y; radius R and colour X. 12 Return ': 4? | . PI - ds 1A no a k dan | s vse. iča dl, 4 Cam ' —- mra, 8 NE ' h ! podijo ia s . - RE (0 TWEN past | Dei ae dvo... KAJA NA > ' a ; ui orey, ku "a i ma "N Ppki?" .." . ič sa ia VALUE LA SAL Hi . m di 1% ua Mide b Koala zi ; H Lej RR - rat, JA s) x. mur rm o z ra | es a: a F IA i ru h | ( kai x- fi BIN ANOTHER OH£ | vid are To ze 0 ma ( rani parpii Mi RAI. les, 2d, Pa Me u s EI z A BR, V) « , KIGYOE zad, Ni Kabi gram sita kih o? x um Z x za mele ' riti KAKE PASAIZ 1676, PEIMNTING PRESE To zu " - sem rim D em | no popek . h s > Ž me TM — P.4 — H mea zob nagi) Dupba RK Ai ve Zaj AJ wo. ČIBEL. Z ma i odk ZE NR ba zve, u ma, % z - mn o s % meniji Po Vonn o A oo. uwoeoevz o s — -— - k '