Arduino IDE: for Loop

Arduino IDE for Loop
About This Tutorial
This tutorial discusses what is loop statement, a for loop, its general syntax in Arduino IDE, and how it works.
Tutorial Info

Components Required

ImageComponentQuantityAvailable in Kit
USB A-B Cable1


A loop statement allows us to execute a statement or group of statements multiple times.

Below is the general form of a loop statement in most programming languages :

for loop

The for loop

A for loop executes statements a predetermined number of times. The control expression for the loop is initialised, tested and manipulated within the for loop parentheses. It is easy to debug the looping behaviour of the structure because it is independent of the activity inside the loop.

Each for loop has up to three expressions, which determine its operation. The following example shows the general for loop syntax in Arduino IDE. Notice that the three expressions in the for loop argument parentheses are separated with semicolons.

for (initialisation; control statement; increment or decrement) {
Body of for loop

Below is the flow chart showing how a for loop works:



Arduino IDE for Loop


Share this Tutorial
Share on facebook
Share on twitter
Share on google
Share on pinterest
Share on reddit
Share on print
Related Projects & Tutorials
How to use evive’s Real-time Clock
This tutorial discusses what is a real-time clock, and how to use evive's real-time clock to show time, date, and day with the help of an Arduino IDE sketch.
All articles loaded
No more articles to load
Featured Projects
Space-Battle-Game on Scratch
Space Battle

This project will show you how to make a cool space battle game on your own in PictoBlox (Scratch-based programming) and play using your Smartphone!

All articles loaded
No more articles to load

Leave a Reply

Close Menu