Announcement

Collapse
No announcement yet.

How Do I jump out of WHILE NOT EOF()

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

  • Bradley Callis
    replied
    So many ways to skin a cat.

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

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

    Bradley Callis

    Leave a comment:


  • Trevor Lane
    replied
    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).]

    Leave a comment:


  • Borje Hagsten
    replied
    > 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

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

    Leave a comment:


  • Scott Turchin
    replied
    Do until EOF(F)
    If Cat=Dog then exit loop
    Loop


    Hope that helps

    Scott


    ------------------
    Scott

    Leave a comment:


  • Mike Trader
    started a topic How Do I jump out of WHILE NOT EOF()

    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
Working...
X