Announcement

Collapse
No announcement yet.

How Do I jump out of WHILE NOT EOF()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How Do I jump out of WHILE NOT EOF()

    WHILE NOT EOF(i)'-------------
    INPUT# i, SymbolStr, Interval, DateStr, TimeStr, OpenPrice, HighPrice, LowPrice, ClosePrice, Dummy
    blah
    blah
    blah
    Check for what i want to Accomplish
    Set a bunch of vars
    etc
    etc
    etc
    WEND

    Now this file is 300k lines and I find what I am looking for about 2/3 the way thru it.
    How do I execute all the rest of the code
    Set a bunch of vars
    etc
    etc
    etc
    and then terminate the loop at the WEND even tho I am not at the end of the file?



    ------------------
    Kind Regards
    Mike

  • #2
    Do until EOF(F)
    If Cat=Dog then exit loop
    Loop


    Hope that helps

    Scott


    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      > Do until EOF(F)
      > If Cat=Dog then exit loop
      > Loop

      Just asked our version of a cat, "Ripper 2", and I believe you are in
      for an endless loop there, Scott. As she said, "Clever cats can never
      become stupid dogs.."

      BTW, I think there is an "errata" in PB help there. It says EXIT
      option DO or LOOP works for both DO/LOOP and WHILE/WEND loops.
      Think the later isn't true..

      Other variation on same theme:
      Code:
       DO WHILE EOF(F) = 0
         If Cat<>Dog Then Exit DO
       LOOP

      ------------------

      Comment


      • #4
        Mike,

        A fairly common technique is as follows.
        all in pseudo code, I don't need to be told about the syntax errors
        It is purely to demonstrate technique.

        Code:
        'you fill in the dims constant declarations etc.
        done = false
        while (not(eof) and not(done))   'brackets always included for clarity
           do something
           do something more
           etc
           test something
           etc
           ah this is what i want
        
           done = true
           ' this will not exit until the wend as the comparison
           ' is not performed until the next iteration
        
           carry on with the rest
        wend
        That is fairly widely used as a programming technique as it is both
        simple to follow and robust.

        regards
        Trevor.

        ------------------


        [This message has been edited by Trevor Lane (edited March 19, 2001).]

        Comment


        • #5
          So many ways to skin a cat.

          do while cat<>dog
          input #1,yada
          cat = parse$(yada,1)
          loop

          ------------------
          Thanks,

          Bradley Callis
          Thanks,

          Bradley Callis

          Comment

          Working...
          X