-
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
Co-Create Success With the Changing Salesforce Ecosystem
The Salesforce partner community is a powerful force. It is a place where Salesforce partners manage their business, learn best practices, get support on projects,…
Salesforce Sales Cloud Features for Smart Management
If you want to centralize your sales data, automate workflows, connect your team members, and use your data to power more deals, then yes. Sales…
Salesforce vs. Hubspot - Which CRM Is the Best for You
At the heart of every sales and marketing team is customer relationship management (CRM) software that makes everything that they do work seamlessly. If you…
Popular Salesforce Videos
Zero Bug Revolution Episode 05 : The Expert Advice with Deepak Visweswaraiah.
"Join us on ""Zero Bug Revolution: The Expert Advice"" with Rupesh Garg, our CEO, and Deepak Visweswaraiah, VP of Platform Engineering at Pega, for a…
5 Important Topics to Crack Salesforce Platform Developer 1 Exam
In this video, Shrey gives you an important topic which gonna be really very helpful for crack the Platform Developer 1 Certification. Without mastering these…
Everything New in Salesforce Developer Tools
Your productivity starts and ends with the tools you use. Learn how Salesforce Developer Tooling can help you collaborate more effectively with your whole team.…