Hi, Andrew,
Thanks for your reply. I don't think it is the problem of a simple while loop. I
attached my script and input file in this msg:

blk: read/lines %test.dat       
while [not empty? blk]
[
    d1:  second (to-block first blk) 
    d1: parse d1 "-"
    d1: to-date d1/1    
    print d1    
    blk: next blk 
    print blk   
    either not empty? blk [print "not empty"][print "empty"]
]

test.dat:

21-Feb-2000    { 2000/02/01-00:20  -  2000/02/08-21:48 }    76    29    
20-Feb-2000    { 2000/02/02-00:20  -  2000/02/08-21:48 }    76    29    
19-Feb-2000    { 2000/02/03-00:20  -  2000/02/08-21:48 }    76    29    


This test.dat file is generated by machine. The weird thing is if I open the
file and clear its tail, the script worked fine. But if I added an empty newline
at the end of file, it won't work. 
** Script Error: Out of range or past end.
** Where: d1: second (to-block first blk) 

When rebol execute 

either not empty? blk [print "not empty"][print "empty"]

it always prints 'not empty' even the content of blk printed is blank.

I'm so frustrated about this. Can u help me out?

Thanks a million.

Tiana

Reply via email to