A Quick Guide on FOR Loops - Part 1
A Quick Guide on FOR Loops
Apex is Salesforce's proprietary cloud-based, object-oriented programming language. Let's break down that a little bit:
- Apex was built by Salesforce, for Salesforce. You will not be able to write and run Apex outside your Org.
- Apex is cloud-based. Unlike many other programming languages, you do not need to install any software to start developing in Apex nor will you have to compile it because the platform will take care of that for you.
- Apex is object-oriented. In Apex, you can create blueprints with attributes and procedures that you can later instantiate into objects.
For example, one common task all programming languages have is how to address procedural cycles - this is when the same process needs to happen to each element of a collection. In the software development world, we address this challenge by using an iteration loop. Apex has six types of loops:
- do-while do { statement (s) } while (Boolean_condition) ;
- while while { Boolean_condition) statement (s);
- traditional FOR for (initialization; Boolean_exit_condition; increment) { statement (s); }
- List / Array FOR
- SOQL FOR
- List SOQL FOR
The first three of them are shared among many, if not all, programming languages. I'll assume that you are very familiar with them, but if you'd like more info check out this site. The last three, on the other hand, are Apex-specific iteration procedures, and we will take a stab at each of them in the next parts of this guide. Continue to Part 2
Awesome
ReplyDelete