-
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
Why Salesforce is the #1 Choice for Customer Service Management
Customer service is at the heart of every thriving business, and Salesforce has positioned itself as the go-to choice for companies looking to transform their…
Displaying Field According to Its Datatype In Salesforce Lightning Component
For my recent Requirement, I had to show the LookUp field of inside a lightning component. I had to use two components, the parent and…
Salesforce Security Interview Questions
These questions cover a range of topics related to data security in Salesforce and should help you prepare for various aspects of Salesforce security management. …
Popular Salesforce Videos
How to Create Opportunity Teams | Salesforce Tutorial
Want to give all the people who help out on your opportunities easy access to the opportunity record in Salesforce? Or maybe you've got an…
What is Salesforce? Career Opportunities and Job Roles in Salesforce!
This video deals with the most important aspect of Salesforce. You'll learn the following things from this video:- 1. What is Salesforce? 2. What business…
Getting started with salesforce
Salesforce is a customer relationship management solution that brings companies and customers together. It's one integrated CRM platform that gives all your departments — including…