Skip to content

三目运算符

书写方式: 表达式1 ? 表达式2 : 表达式3

  1. 对表达式1进行boolean判定
  2. 如果判定结果为真,返回表达式2;否则,返回表达式3。