-
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
Salesforce Consulting Services for Enterprise Integration Challenges
Enterprise technology landscapes grow more complex every year. Large organizations operate hundreds of disparate applications across cloud and on-premise environments. Recent data shows that 82%…
CPQ and CRM: The Best of both Worlds to Empower your Sales Teams
How efficient are your sales processes? While there may not be a definitive answer to this question, it makes us rethink our sales processes and…
How to Hire Salesforce Developers During the 2023 Economic Downturn?
The pressure of economic recession is lurking around and spending on technology is expected to take a downturn. However, when it comes to the Customer…
Popular Salesforce Videos
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.…
Customizing and Replacing Sample Salesforce Data
Leverage our sample use case for Salesforce to learn how HyperIntelligence works—and rapidly get your own cards up and running! In this video, we’ll demonstrate…