Search code examples
apex-code

Too many script statements


If I want to populate an array with a large number of primative type values using a loop. How can I overcome the Too many code statements limit?

Integer[] arr = new Integer[]{};
for(Integer i=0; i<500000; i++) {
     arr.add(i);
}

Thanks.


Solution

  • This could help http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm

    It shows some limits on amount of scripts in the code I think you are working in.

    Tell me if it works!