Skip to main content
There are 5 loop Types in Apex
But not all of them are used
Using while loops is considered a bad practice, because...it's easy to mess up
From remaining 3 - for each is used 90% of the time
But standard for loop is fundamental
If you understand the standard loop, you
understand all other types
So, let's do it
Definition: Loop is a block of code that
runs a certain number of times
Let's look at the
example
Let's say, I want to output 5 times (or 500)
"Wow, I love Apex" to logs, but I am too
lazy to write each line