Menu

Select case

Help
jackjames
2018-05-11
2018-05-11
  • jackjames

    jackjames - 2018-05-11

    About the SELECT statement:
    Several basic compilers allow the use of this instruction with multiple variables on the same line.
    Example:
    SELECT CASE GOOFY
    CASE A
    .........
    CASE B, F, T
    ........
    END SELECT
    Why has this function not been implemented?

     
    • Chris Roper

      Chris Roper - 2018-05-11

      Because unlike Computer Implementations of BASIC, Microcontrollers are RAM constrained.
      In addition to that the RAM in PIC Microcontrollers is segmented.
      As a result variable /RAM use is the largest constraints on what gets implemented.
      In fact I am often surprised at the fact that such an extensive set of commands are available and yet Great Cow BASIC still compiles to efficient machine code, unlike the other versions of basic for PIC that are not true compilers and offer only a fixed set of variables.

       
  • Anobium

    Anobium - 2018-05-11

    Improvements to select case were added at v0.97.01 change 400. The Help shows these new capabilities.

    So, are you asking for an enhancement? Chris makes the case very well. We need to think every time we extended.

     
  • stan cartwright

    stan cartwright - 2018-05-11

    "unlike the other versions of basic for PIC that are not true compilers and offer only a fixed set of variables."
    b0-b55 ? :)
    ;
    What's the difference between using case var and using if var then do code : goto end test (to skip following if var= tests, in speed and memory comparison.
    I ask because originally basic was interpreted and slow so I used "tricks" to speed it up..
    like use if var1=val then if var2=val then , instead of if var1 and var2=val then. (so if var1 <> val it will skip 2nd if then so faster than and which is 2 tests)
    Looking at gcb asm output would mean little to me so don't know what is faster code.
    I like to play with glcds and that's were you can see code speed differences.
    Is reading data from a table faster than reading from a variable( array)?
    Is this worth opening a topic on? ie write faster code with gcb.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.