Author Topic: Case Ranges Single Sided  (Read 2108 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Case Ranges Single Sided
« on: December 05, 2014, 04:04:10 PM »
Further extension of case syntax with comparator symbols < > =

Code: OxygenBasic
  1. float a=-.51
  2.  
  3. switch a
  4. case < 0    : print "<0"
  5. case <= 0   : print "<=0"
  6. case 0      : print "0"
  7. case > 0    : print ">0"
  8. case >= 0   : print ">=0"
  9. case <>0    : print "<>0"
  10. end switch
  11.  
  12.  
  13. select a
  14. case < -1.0 : print "< -1.0"
  15. case < -0.5 : print "< -0.5"
  16. case <  0.0 : print "<  0.0"
  17. case <  0.5 : print "<  0.5"
  18. case <  1.0 : print "<  1.0"
  19. case >= 1.0 : print ">  1.0"
  20. end select
  21.  

Update:
http://www.oxygenbasic.org/o2zips/Oxygen.zip

JRS

  • Guest
Re: Case Ranges Single Sided
« Reply #1 on: December 05, 2014, 04:33:37 PM »
Nice addition to O2 Charles.

Thanks!