Arduino If ... else语句
2018-11-02 17:49 更新
一个 if 语句后面可以跟随一个可选的else语句,当表达式为false时执行。
if ... else语句语法
if (expression) {
Block of statements;
}
else {
Block of statements;
}if ... else语句 - 执行顺序

/* Global variable definition */
int A = 5 ;
int B = 9 ;
Void setup () {
}
Void loop () {
/* check the boolean condition */
if (A > B) /* if condition is true then execute the following statement*/ {
A++;
}else {
B -= A;
}
}
以上内容是否对您有帮助:

免费 AI IDE


更多建议: