声明和说明 |
if 语句
if 语句由一个布尔表达式和一个或多个语句组成。这些语句在给定的布尔表达式为真时执行。
|
if...else 语句
if 语句后面可以跟一个可选的
else 语句,当布尔表达式为假时执行。
|
unless 语句
unless 语句类似于带有布尔表达式的
if后跟一个或多个语句,除了。这些语句在给定的布尔表达式为假时执行。
|
unless...else 语句
unless 语句后面可以跟一个可选的
else 语句,当布尔表达式为真时执行。
|
switch 语句
switch 语句允许根据值列表测试变量是否相等。
|
声明和说明 |
if-then 语句
使用 if-then 语句我们可以写出
if CoffeeScript 的单行语句。它由一个布尔表达式和 then 关键字组成,然后是一个或多个语句。这些语句在给定的布尔表达式为真时执行。
|
if-then...else 语句
if-then 语句后面可以跟一个可选的
else 语句,当布尔表达式为假时执行。使用 if-then...else 语句,我们可以在一行中编写 if...else 语句。
|
unless-then 语句
使用unless-then 语句,我们可以写
unless CoffeeScript 的单行语句。它由一个布尔表达式后跟
then 关键字组成,后跟一个或多个语句。这些语句在给定的布尔表达式为假时执行。
|
unless...then else 语句
unless-then 语句后面可以跟一个可选的
else 语句,当布尔表达式为真时执行。使用unless-then...else 语句,我们可以在一行中编写unless...else 语句。
|
#Postfix if Statements to be executed if expression #Postfix unless Statements to be executed unless expression