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
suneel.patchipulusu@gmail.comsuneel.patchipulusu@gmail.com 

Could any one explian thius small code

public static void handleDIOpportunities (List<Opportunity> opportunities) 
	{
		for (Opportunity opp: opportunities)
		{
			computeState(opp);
		}

List<Opportunity> opportunities ia an argument for the handleDIOpportunities

 

What exactly for loop does??

All list opportunities assign to Opp 

 

Here what is ComputeState????

 

Thanks in advance

bob_buzzardbob_buzzard

The loop is just iterating all elements in the list - this is shorthand for a loop such as:

 

for (Integer idx=0; idx< opportunities.size); idx++)
{
   Opportunity opp=opportunities[idx];
   computeState(opp);
}

 

computeState looks like a method declared elsewhere in your class.

 

souvik9086souvik9086

Here computeState is a method where all the opportunities are passing individually(iterating through that for loop) from "opportunities" variable to compute something.

 

Thanks