Using "Loops"

Hello! Welcome to my second tutorial.
This is a very simple lesson, but I am using it in a way some people would not.
We will be using loops to count players, entities, and blocks today!
How do I use loops, you may ask? After an event and the correct syntax, you can use a loop.

Let's start with an event, shall we?
I will be using Every 5 seconds for this event.
every 5 seconds:

Now, let's add the "loop". I will be using "loop all players:", which will loop a command for every player in your server.
every 5 seconds:
loop all players:

What should you do next to count the players? First, we must set the variable to 0, with the "on script load:" event. I prefer this to options, because options is more complicated than an event.

on script load:
set {pcount} to 0

Next, we must add on to the every 5 seconds event. Now we can add other commands regarding variables.
every 5 seconds:
loop all players:
add 1 to {pcount}

You can repeat this with anything! Blocks, entities, and mobs!
Instead of "mobs", you will use "loop-mob".
Instead of "player", you will use "loop-player".
Instead of "entity", you will use "loop-entity".
And so on, and so on. Basically, any type of entity you'll be able to use outside of loops, just with "loop-" before the type.