Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to format a While... Wend correctly?
#1
Another simple one:
What's the best way to skip a data item when searching a file? (the number of items is not known, and the item lengths are varied). 
For example, to skip an item and jump to  a GetData line in this listing:

MyFile$="MyFile"            
Open MyFile$ For Input As #1
' put GetData: here?
            While Not EOF(1)
' or GetData: here?
                Input #1, data$ 
                If Len(data$) <> 5 Then 
                  GoTo GetData
                else
                  DealWithIt
                End If
' or GetData: here
            Wend
Close

Forgetting our "phobias" about GoTo for now,
If the GetData  point is before the While statement,  will this create another loop, and leave the first one unresolved?
If it's just after the While statement, does whe While restart input at the beginning of the file?
Is the position just before the Wend the correct place?
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
How to format a While... Wend correctly? - by PhilOfPerth - 02-26-2024, 04:20 AM



Users browsing this thread: 1 Guest(s)