Re: While statement

new topic     » goto parent     » topic index » view thread      » older message » newer message

I am assuming that line is declared as a sequence. gets() can return a 
sequence, which is the line, or -1 at the end of the file. In this case, it 
is returning -1, which cannot be assigned to a sequence. The solution is to 
declare line as an object, and then check if it is an atom, in which case, 
you would exit the loop. This is already done in the code, though.

>From: sixs <sixs at ida.net>
>Subject: While statement
>
>Hello,
>I have this routine in two programs. one runs ok. the other gets an error 
>message
>" type_check failure, line is-1"
>. I read in the documentation the short circuit  could  be involved. Is it  
>involved and how does it work?
>jvandal
>===== code===========
>  buffer = {}
>  tries = 0
>  countlines = 0
>  clear_record()
>  while 1 do
>   line = gets(Handlers)
>   if atom(line) then
>    exit
>   end if
>   line[length(line)] = 32
>   buffer = buffer & line
>  end while
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu