A loop can repeat a block of code multiple times. The four main types of loops are while, do-while, for, and foreach.

Get hands-on with 1300+ tech skills courses.