-
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
Custom Notification With Process Builder in Salesforce
Custom Notification is a modified notification where the administrator can add beneficiaries, subjects, and substances. Administrators can be sent a custom notification when any significant…
Why Automate Sales Contract Management in Salesforce?
Sales contract management reflects how a company organizes all steps of the sales flow and is essential for recognizing revenue. It is no surprise that…
Optimizing Community Management through Khoros and Salesforce Integration
With its extensive set of capabilities, Khoros is a powerful platform that has great potential in the world of online communities. On the other hand,…
Popular Salesforce Videos
How to Delete Multiple Contacts at Once | Salesforce Tutorial
Do you need to delete a bunch of records? Don't want to delete records one by one? This video shows you several ways to delete…
What are Roll-up Summary Fields in Salesforce? | How to create them?
In this video, Shrey is not only teaching but also demonstrating to you "What are Roll-up Summary Fields in Salesforce?". You will be learning: 1.…
Video calling in Salesforce using WebRTC
Enhance your contact center offering by integrating WebRTC video calling directly into Salesforce Service Cloud. This video will guide you in understanding how you can…