Loading ...
Sorry, an error occurred while loading the content.
 

P. S. Re: [libertybasic] Re: if then error

Expand Messages
  • Kenneth J. Lewis, Sr.
    while cutting and pasting code from one window to another to see when the problem occured I had no problem untill I pasted this code into the window... if
    Message 1 of 1 , Jul 4, 2001
      while cutting and pasting code from one window to another to see when the
      problem occured I had no problem untill I pasted this code into the
      window...

      if instr(a$," ")>0 then
      close #T
      call spaces filename$
      else
      if instr(a$,",")>0 then
      close #T
      call commas filename$
      else
      close #T
      call oops file$
      end if
      end if

      I am currently reading up to see if nested if... then... else is ok I know
      nested if ... then is ok, and I know that if ...then is ok nested inside an
      if...then...else.
      Ken
      ----- Original Message -----
      From: "Kenneth J. Lewis, Sr." <kenlewissr@...>
      To: <libertybasic@yahoogroups.com>
      Sent: Wednesday, July 04, 2001 11:01 PM
      Subject: Re: [libertybasic] Re: if then error


      > Here is the entire program. I was trying to write a program in response to
      > the text manipulation questions posted on LBNews. This program would
      decide
      > if the text file was delimited by spaces or commas and would call the
      > appropriate sub-program to input the text into an array. Please try to run
      > this code and see if it works, if not please look it over and see if you
      can
      > spot the problem. Watch for line wraps.
      >
      >
      > dim array$(100000)
      >
      > filedialog "Open text file", "*.txt", filename$
      >
      > for x=len(filename$) to 1 step -1 'get the filename w/o the path
      > if mid$(filename$,x,1)="\" then
      > file$=right$(filename$,len(filename$)-x)
      > x=1
      > end if
      > next x
      >
      > open filename$ for input as #T
      >
      > line input #T, a$
      > if instr(a$," ")>0 then
      > close #T
      > call spaces filename$
      > else
      > if instr(a$,",")>0 then
      > close #T
      > call commas filename$
      > else
      > call oops file$
      > end if
      > end if
      >
      > for z=1 to x
      > print array$(x)
      > next x
      >
      > end
      >
      > sub spaces file1$
      > open file1$ for input as #T
      > while eof(#T)<>-1 and x<100001
      > y=1
      > line input #T, a$
      > while word$(a$,y)<>""
      > x=x+1
      > array$(x)=word$(a$,y)
      > y=y+1
      > wend
      > wend
      > close #T
      > end sub
      >
      > sub commas file1$
      > open file1$ for input as #T
      > while eof(#T)<>-1 and x<100001
      > input #T, a$
      > x=x+1
      > array$(x)=a$
      > wend
      > close #T
      > end sub
      >
      > sub oops fileExt$
      > oops1$="This does not appear to be a valid text file."
      > oops2$="It is not delimited by spaces or commas!"
      > notice "INVALID FILE...
      > "+chr$(34)+fileExt$+chr$(34)+chr$(13)+oops1$+chr$(13)+oops2$
      >
      > Thanks again
      > Ken
      >
      > ----- Original Message -----
      > From: <carlg@...>
      > To: <libertybasic@yahoogroups.com>
      > Sent: Wednesday, July 04, 2001 10:19 PM
      > Subject: [libertybasic] Re: if then error
      >
      >
      > > Ken,
      > >
      > > Look at the surrounding code and make sure that other control flow code
      > (if/then, for/next, while/wend, etc.) is properly constructed.
      > >
      > > In the meanwhile, I'll do my best to make sure the next release of
      Liberty
      > BASIC has friendlier compile errors. :-(
      > >
      > > -Carl
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > libertybasic-unsubscribe@egroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.