home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / f / nbasic.lbr / NBASXMPL.BZS / NBASXMPL.BAS
Encoding:
BASIC Source File  |  1993-10-26  |  1.6 KB  |  44 lines

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