目录

If …else statement

if语句后面可以跟一个可选的else语句,该语句在表达式为false时执行。

if ... else语句

if (expression) {
   Block of statements;
}
else {
   Block of statements;
}

if ... else语句 - 执行顺序

如果是其他声明

例子 (Example)

/* 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;
   }
}
↑回到顶部↑
WIKI教程 @2018