Shop OBEX P1 Docs P2 Docs Learn Events
CASE statement for SX/B? — Parallax Forums

CASE statement for SX/B?

Brian CarpenterBrian Carpenter Posts: 728
edited 2006-02-02 13:04 in General Discussion
Is there a Case Statement for the SX/B
Right now i can do this in PBasic

SELECT Xaxis
    CASE 0 TO 6400
      GOSUB EUpQuick
    CASE 6401 TO 6500
      GOSUB EUp
    CASE 6900 TO 6999
      GOSUB EDown
    CASE >=7000
      GOSUB EDownQuick
    CASE ELSE
      DEBUG CR, "       ECenter"
        pw = 735
        S_Chan = cha
        S_Speed = rb
        GOSUB SendIt
  ENDSELECT

anything similar?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


It's Only A Stupid Question If You Have Not Googled It First!!

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2006-02-02 12:47
    Yea, you can use Lookdown, and Branch together. At least thats how I replaced my select case statement.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.
  • BeanBean Posts: 8,129
    edited 2006-02-02 13:04
    No there is no "SELECT-CASE" statement in SX/B. You have to do something like this:
     
    IF Xaxis >= 7000 THEN
      GOSUB EDownQuick
    ELSE
      IF Xaxis >= 6900 THEN
        GOSUB EDown
      ELSE
        IF Xaxis > 6500 THEN
          DEBUG CR, "  ECenter"
          pw = 735
          S_Chan = cha
          S_Speed = rb
          GOSUB SendIt
        ELSE
          IF Xaxis >= 6401 THEN
            GOSUB EUp
          ELSE
            GOSUB EUpQuick
          ENDIF
        ENDIF
      ENDIF
    ENDIF
     
    
    

    Bean.







    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
Sign In or Register to comment.