-
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
How To Be A Salesforce Developer?
From 2014, unarguably the best way to start learning Salesforce is through Trailhead. Think of it as the best university to enroll yourself in for…
How to Export Data from Salesforce to Excel and Backup Your Data On-Demand
Have you ever combatted with your data in Salesforce only to create a report and then export it to Excel? For an average user, it…
Popular Salesforce Videos
Create Your First Salesforce App in 30 Minutes
In this session, we will design, build and deploy a Salesforce App in 30 minutes using the low code and Salesforce modern developer tooling. Presenter…
Understanding Basics of CRM, Cloud Computing & Salesforce
With cloud computing, businesses access applications via the internet. It's called Software As A Service (or SaaS). Businesses are freed up from having to maintain…
Batch Apex In Salesforce | Asynchronous Apex
Asynchronous Apex 1. Batch Apex 2. How to run Batch Apex class 3. Monitor Batch Apex class 4. Examples 5. Points To Remember Upcoming Video…