>- see footer for list info -<
If it's empty, the loop will never run.

Ade

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen Moretti
Sent: 08 September 2006 12:10
To: Coldfusion Development
Subject: Re: [CF-Dev] Error looping an array


>- see footer for list info -<
On 08/09/06, Dominic Watson <[EMAIL PROTECTED]> wrote:
> >- see footer for list info -<
> Hi guys, I'm getting an error I can't fathom. It's an index out of bounds
> error while looping an array and it it only happens about 0.5% of the
time,
> seemingly randomly.
>
> The code looks something like this:
>
> <cfloop from="1" to="#arrayLen(myArray)#" index="i">
>     <cfif myArray[i] = 'eat my shorts'>
>         <!---- do stuff --->
>     </cfif>
> </cfif>
>
> The index out of bounds error is occurring on the 'eat my shorts' line.
How
> might this be?
>
If your array myArray is empty you'll have an arrayLen of zero and
myArray[0] is out of bounds, as CF arrays start at 1 and not 0.

So you need to look at how myArray is being defined and populated to
work out why it would be empty.

Hope that helps

Stephen
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to