Device Monitoring Studio Documentation Advanced Features Protocol Binding Language Reference Statements if Statement
if
statement has the following syntax:
statement-if:
if (expr)
statement-block | { statement-block * }
[else
statement-block | { statement-block * }
]
statement-block:
statement | field-declaration
expr
is evaluated at run-time and if true
, the first statement-block is evaluated, otherwise, the second statement-block is evaluated. If it is omitted and expr
is false, nothing is evaluated and control flows to the next statement or declaration. If multiple statements or declarations need to be specified in the body of if or else, use the curly braces. For example:
struct A
{
int a;
if (a>0)
float b;
else
{
double b;
int c;
}
};