home *** CD-ROM | disk | FTP | other *** search
- 10 'Comprehensive NBASIC Demonstration Program
- 20 'COPYRIGHT 1984 Merrill W. Hulse. ALL RIGHTS RESERVED.
- 30 'Permission granted for non-commercial use and distribution.
- 40 'Commercial use without the author's written permission is forbidden.
- 50 'Example of a target label with required remark following.
- 60 INPUT "ENTER X ";X
- 70 PRINT:PRINT "Your test entry is:'TEST'";X
- 80 I0=(X)' Example of CASE OF [expression].
- 90 IF I0<>(0) GOTO 120
- 100 GOTO 270'Example of GOTO [label]
- 110 GOTO 210'Stand-alone label needs remark.
- 120 IF I0<>(1) GOTO 150
- 130 A = X:GOSUB 290'Example of GOSUB [label]
- 140 PRINT B$:GOTO 210
- 150 IF I0<>(2) GOTO 180
- 160 IF X = 2 THEN 310'Example of THEN [label]
- 170 GOTO 210'Stand-alone label needs a remark.
- 180 ' Else condition
- 190 IF X < 9 PRINT "Number is between 3 and 8." ELSE 330
- 200 'Stand-alone label needs a remark.
- 210 ' Endcase
- 220 NUMBER=X: GOSUB 400: WRDS$=STRNG$: A=OTHERNUMBER:
- 230 '' REM gets converted to "'". Example of CALL follows.
- 240 PRINT WRDS$;A
- 250 INPUT;"Would you like to try another test (Y/N)";ANSWER$
- 260 IF ANSWER$="Y" GOTO 50 ELSE END
- 270 PRINT "TEST";X
- 280 GOTO 110
- 290 PRINT "TEST";X
- 300 RETURN
- 310 PRINT "TEST";X
- 320 GOTO 170
- 330 PRINT "TEST";X
- 340 FOR I1=0 TO 1:' REPEAT'Example of REPEAT...UNTIL loop.
- 350 A=1
- 360 PRINT "TEST";A,:A=A+1
- 370 I1=-1*(A=5):NEXT I1' UNTIL (A=5)
- 380 GOTO 200
- 390 'Example of a SUB vectored from a CALL follows.
- 400 ' SUB "TEST4" TAKES NUMBER GIVES STRNG$;OTHERNUMBER
- 410 STRNG$="Little number":OTHERNUMBER=X
- 420 IF NUMBER>5 THEN STRNG$="Twice your number is:":OTHERNUMBER=2*NUMBER
- 430 RETURN
- 10 STRNG$="Little number":OTHERNUMBER=