ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
1.6 KiB

  1. 0100 rem ------------------------------------------
  2. 0110 rem Filename: case3.bas
  3. 0120 rem Purpose: Verify CASE TO
  4. 0130 rem ------------------------------------------
  5. Sub Main
  6. Print "SelCase.bas -- test SELECT CASE statement"
  7. rem Input "Enter a number"; d
  8. for d = -11 to 11 step 1
  9. print "d="; d
  10. Select Case d
  11. Case 3 to 5
  12. print "In Case 3 to 5"
  13. if d < 3 then goto TestFailed
  14. if d > 5 then goto TestFailed
  15. Print "The number is between 3 and 5."
  16. Case 6
  17. print "In Case 6"
  18. if d <> 6 then goto TestFailed
  19. Print "The number you entered is 6."
  20. Case 7 to 9
  21. print "In Case 7 to 9"
  22. if d < 7 then goto TestFailed
  23. if d > 9 then goto TestFailed
  24. Print "The number is between 7 and 9."
  25. Case If > 10
  26. print "In Case If > 10"
  27. if d <= 10 then goto TestFailed
  28. Print "The number is greater than 10"
  29. Case If < 0
  30. print "In Case If < 0"
  31. if d >= 0 then goto TestFailed
  32. Print "The number is less than 0"
  33. Case Else
  34. print "In Case Else"
  35. if d <> 0 and d <> 1 and d <> 2 and d <> 10 then goto TestFailed
  36. Print "The number is 0, 1, 2 or 10."
  37. End Select
  38. next d
  39. 8000 rem ------------------------------------------
  40. 8010 TestPassed:
  41. 8020 print "*** ALL TESTS PASSED ***"
  42. 8030 goto TheEnd
  43. 8500 rem ------------------------------------------
  44. 8510 TestFailed:
  45. 8520 print "*** TEST FAILED ***"
  46. 8530 goto TheEnd
  47. 9000 rem ------------------------------------------
  48. 9010 TheEnd:
  49. 9999 quit
  50. End Sub
  51. CALL MAIN
  52. PRINT "*** SUB MAIN() was not executed ***"
  53. STOP
  54. END