Device Monitoring Studio - Monitor, log and analyze data coming through PC ports and connections
Download Device Monitoring Studio Hide this button

for Statement

for statement has the following syntax:

statement-for:
for (init-expr; condition-expr; increment-expr)
    statement-block

for statement is equivalent to the following construct:

init-expr;
while (condition-expr)
{
    statement-block;
    increment-expr;
}

It evaluates statements in statement-block while condition-expr evaluates to a non-zero value.

Note that unlike C/C++, all for statement expressions must be present and cannot be omitted. Device Monitoring Studio does not support unary operators like ++, --, +=, -= and others, so increments must be specified in the form of i = i + 1 instead of ++i.

init-expr must have the following syntax:

init-expr:
var name = expr

For example,

for (var i = 0; i < 10; i = i + 1)
{
    int a;
}