Re: While statement

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

sixs <sixs at ida.net> wrote:

> 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
    ^^^^^^--- You can write this shorter, BTW:
    buffer &= line
>  end while

This piece of code isn't complete, the variable declarations are missing.
I assume that 'line' was declared as sequence. But if you use 'line'
this way (which is very common in Euphoria), it must be declared as
object: If 'atom(line)' is TRUE, then 'line' holds -1, otherwise 'line'
holds a sequence.
This has nothing got to do with short-circuit evaluation.

Regards,
   Juergen

PS: Please don't send e-mail containing any HTML code to this list.
    Send plain text only. Thanks in advance.

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu