-
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
Unboxing Salesforce Knowledge Rest APIs
SF knowledge rest APIs come in 4 different flavours (Types) based on the polymorphic nature of the data model and each different type (as below)…
All You Need to Know About Salesforce Meetings
Every organization has a Sales department that wishes to have separate functionalities for speedy interactions with potential customers. Instead of making plans for meetings for…
Native vs Non-native Salesforce App: Which One is Better?
Native Salesforce Apps Native Salesforce apps are those apps that are developed on the Force.com development platform without any external server or code. In other…
Popular Salesforce Videos
Object Oriented Programming - Salesforce Developer Tutorial
In relation to programming languages, object-oriented means that the code focuses on describing objects. An object can be anything that has unique characteristics, such as…
Salesforce For Non Programmers | Salesforce For Non Technicals
You can learn Salesforce without any programming language. You can plan Salesforce Administrator Certification which requires no coding skills. Watch this video to learn how.
Salesforce Winter 21 Release - Sneak Peek
The Winter ’21 release delivers innovations across the Salesforce Customer 360 platform to help connect you to your customers, from anywhere. Fancy table updates, live…