function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shephali SwarnkarShephali Swarnkar 

Help to understand why each LOC executes for that many times

for(List<Opportunity> accs : [Select Name from Opportunity])
       System.debug('size' +accs.size());
      System.debug('OUTsize' +I);
System.debug('OUTsize' +I);

User-added image
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Shephali,

This will execute only once and you will get each system.debug statement only once. Can you let me what excatly are you expecting.

Shephali SwarnkarShephali Swarnkar
Hi Praveen,

     i just wanted to understand the debuging and execution. 
 1. why SOQL executed for just one time. i have 2430 opportunity records. if it forms batches then why only for 1 time executes why not 2430/200 times.
 User-added image
2. Why line 4 executed for 39 times.
3. why line 7 executes for 2 times.

Shephali SwarnkarShephali Swarnkar
Refer this SS for codesnipped
User-added image