Hardware Reference
In-Depth Information
• Create a new variable called
i
and set its value to zero. This initialization
is defined by the first part of the
for
statement.
• Check if
i
is less than 3. Because it's 0, this evaluates to be true. This
condition is defined by the second part of the
for
statement.
• Print “Loop iteration number: 0” to the serial monitor.
• Increment
i
by one, so that its value is now 1. This afterthought is defined
by the third part of the
for
statement.
• Check if
i
is less than 3. Because it's 1, this evaluates to be true.
• Print “Loop iteration number: 1” to the serial monitor.
• Increment
i
by one, so that its value is now 2.
• Check if
i
is less than 3. Because it's 2, this evaluates to be true.
• Print “Loop iteration number: 2” to the serial monitor.
• Increment
i
by one, so that its value is now 3.
• Check if
i
is less than 3. Because it's 3, this evaluates to be false and the
loop ends.