-
What is the difference between these two(loop) codes?
Hi All,
What is the difference between these two(loop) codes?
1) List<Account> accountList = new List<Account>();
accountList = [SELECT Id FROM Account];
for(Account a: accountList){
a.Name = 'update';
}
update accountList;2) for(Integer a = 0; a < accountList.size(); a++){
accountList[a].Name = 'update';
}
update accountList;Does for loop and for each loop works differently?
Thanks
Log In to reply.
Popular Salesforce Blogs
Iteration Components Used In Salesforce VisualForce Pages
Iteration Components Used In Salesforce Visualforce Pages Iteration Components allow you to display the output of content on the page in the form of a…
Advanced Salesforce Reporting Features for Admins
Among the immeasurable reasons to consider Salesforce, there’s one thing that attracts users to this CRM. The provision to create customized and retailed reports has…
Syncing Business card data to Salesforce . .
Industry estimates hardly 30% of business cards received, enter into Salesforce, why ?? Salesforce is one of the most Popularly used CRM and has evolved…
Popular Salesforce Videos
myTrailhead Product Filters | Salesforce Tutorial Video
Salesforce myTrailhead has now released their next update in product filters. You can now create your own product filters that are relevant to your business…
How to Get Your Data In and Get Insights Out | Salesforce Essentials
Organize all your data with Salesforce Essentials. With a quick and easy import, you’ll be able to manage your business and watch it grow. Essentials…
Crash Course on Apex Triggers Salesforce | Complete Guide with Real Time Scenarios
Complete guide on Apex Triggers Salesforce 0:00 Intro 0:33 Is Triggers difficult to Learn 0:50 What is Trigger? 3:03 What are Trigger events? 11:55 How…