This example uses the repeat forever construction: it allows a light bulb to change its on-off state every 1 sec.
- Scratch link: http://scratch.mit.edu/projects/16469252/
- Program file: P3_light_bulb.sb2
Program 3
A forever loop in Scratch allows one to watch certain actions for as long as one wants. For most computations and in other languages, infinite loops are not desirable. They signal that something is wrong with the program. It can be a simple mistake like not increasing a variable as intended or a more serious error in the logic underlying the program. More discussion on infinite loops is in the Misconceptions and Challenges post. Video Length: 2:32