in reply to Re^2: Control Structure problem, mistake can't be found
in thread Control Structure problem, mistake can't be found

As has already been pointed out by oshalla, you don't want to use length on an array, but rather scalar. A few other important notes: