For Beginners

Lesson 10/23

Looping Things

Now you are about to do something more complicated — like font size animation, for instance.

At first, the font size will be 10, then it should increase gradually to 100 with a step equal to 10. This can be achieved with a for loop:

program notepad
keyboard Hello⋘enter⋙world!
for ♥fontsize from 10 to 100 step 10
	keyboard ⋘alt+o⋙f
	window font
	keyboard ⋘tab 2⋙♥fontsize⋘enter⋙
end

Note that the first declaration of the ♥fontsize variable isn't necessary. It's starting value is set with the from argument. Also note the indents of lines inside the for...end loop: they aren't obligatory, but help you to spot the looped code.

Run the script and see your text growing automatically in Notepad.

In the next lesson you will learn how to make use of procedures.