-
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 Trailhead and Certification Leader Board - ForceLeaderBoard (Unofficial)
Force Leader Board - Salesforce Trailhead and Certification Leader Board Here it comes ... It's time to show your trailhead badges and certifications in on place.…
Retrieve picklist value of a Record Type using MetaData Service in Salesforce
Picklist values are able to see using standard UI of sObject then field name and then record type name. What if we want to see…
Salesforce Managed Services: Is it the Key To Cost-Efficiency For Salesforce Users?
Manual workflows, lack of personalization, and siloed data architecture of traditional CRMs prompt businesses to look for advanced CRM solutions. Salesforce is one such platform…
Popular Salesforce Videos
Introduction to Quip for Customer 360 | Salesforce
In Quip for Customer 360 Admin Foundations, you’ll be introduced to Quip for Customer 360 from the admin perspective. You will gain an understanding of…
How To Get Exam Voucher For Salesforce?
Wondering How To Get Exam Vouchers For Salesforce? Join this useful group for Salesforce job & career info and learn all you need to know…