Menu

FOR/WHILE loops

Developers
2007-06-14
2013-10-17
  • henry Butowsky

    henry Butowsky - 2007-06-14

    Hi Charlie,
    Have commited the first cut of while & for loops
    Like C they both respond to break/continue.
    Due to a grammar hitch they don't currently accept empty expressions f
    Please test to destruction

    Will optimize soon when I have a better idea of their use.
    Sample for loop below:

    a1=time;
    *u1=time;

    for(*kdx=0 ; kdx<10; kdx++){
      if(kdx==3) continue;
      if(kdx==8) break;
      u1(kdx)=kdx/100.0;
    }
    ram_write(u1);

    All expressions must be filled. out can't do stuff like
    for( kdx=0; ; )

    Regards Henry

     
    • Charlie Zender

      Charlie Zender - 2007-06-14

      Hi Hencry,

      That's great.
      I just implemented loops in bin_cnt.nco, which reduces this script to a nice, compact size.
      They appear to work.
      The usage case to optimize for is bin_cnt.nco with flg_prd=1.

      Thanks,
      Charlie

       
    • henry Butowsky

      henry Butowsky - 2007-06-19

      Hi Charlie,
      Have done some optimization for speeding up scotts script.
      In an assign  statement eg
      EXPR a[time]=10 ;
      EXPR a(0:4)=20;
      The final value is not returned (see action  for statements/EXPR )

      Tried running BMs on my machine but I don't have the juice to work out whats working.
      If you can pull the latest code onto sand and compile -- then I can copy your source and run some more BMs on sand. Will ring tomorrow morning if thats OK

      Regards Henry

       
      • Charlie Zender

        Charlie Zender - 2007-06-19

        > If you can pull the latest code onto sand and compile --

        You can do this with your sand account.

        > then I can copy your source and run some more BMs on sand.
        > Will ring tomorrow morning if thats OK 

        OK at 11 AM PDT.

         

Log in to post a comment.