Re: Line Generator
- Posted by Brian Broker <bkb at CNW.COM> Sep 07, 2000
- 479 views
On Thu, 7 Sep 2000 16:09:03 -0700, Paul Kerslake wrote: >Can anyone tell me why I'm getting an error from this: > >include get.e > >atom desc > >desc=gets(0) >? desc >desc=desc[1] >? desc >while desc>0 do > puts(1,"!") >end while > > >I'm making a program that generates lines according to what they type in, but I need the enter ereased but not all the other numbers. > >-Thanks. >-Thomas You might want to read the Euphoria Reference Manual over again: Because either a sequence or an atom (-1) might be returned by gets(), you should probably assign the result to a variable declared as object. That being said, you might try something like: include get.e object desc desc=gets(0) ? desc if sequence( desc ) then -- user did not hit Ctrl-Z desc = desc[1..length(desc)-1] -- remove last element from sequence end if ? desc -- I'm not sure what you are trying to do below since 'desc' is a sequence -- unless we've hit 'end of file' or Ctrl-Z --while desc>0 do -- puts(1,"!") --end while ------------------------- Perhaps if you provide more details of what you'd really like to do, then we could suggest some other, possibly better solutions. -- Brian