You can code the loop...
for i=1 to 10
print "Hello #",i
endfor
...as...
print "Hello #1"
print "Hello #2"
print "Hello #3"
print "Hello #4"
print "Hello #5"
print "Hello #6"
print "Hello #7"
print "Hello #8"
print "Hello #9"
print "Hello #10"
They are equivalent programs. You can do this even for complicated loops with a variable end point...
for i=1 to y
print "Hello #",i
end for
...could be rewritten as...
if y>=1 then print "Hello #",1
if y>=2 then print "Hello #",2
if y>=3 then print "Hello #",3
...(up to the maximum possible value of y)...
This is called "loop unrolling" and you can theoretically do this for any finite loop, but as you can see in the examples above the code can get very large.
In bitcoin, the size of your script is both theoretically and practically limited in several places, so this ultimately limits the maximum number of loop iterations you can unroll in a bitcoin script, but it is possible to implement a low iteration count loop like for i=1 to 5
in bitcoin script using unrolling.
for
loop, which is not possible in Bitcoin.