写法1:
condition && yes; // 等同于“if (condition) yes;”
写法2:
condition ? yes : no // 等同于“if (condition) {yes} else {no};”
写法3:
if (condition) { yes; }else{ no; }
写法4:
if (condition) yes; // 等同于“if (condition) {yes};”
写法5:
if (condition): yes; else: no; endif;
<完>
感谢 Renfei Song 提示第5种写法,^_^;