布尔逻辑对你规划条件语句的结构特别有用。
Boolean logic is especially useful for formulating clear conditional statements.
我们有一个循环,通过一个条件和一个布尔值来判断,是否触到了边缘,还有一些语句,让它回头并咆哮。
You've got a loop, you've got a condition and a Boolean to check if he's touching the edge, and some statements to tell him to shout or to actually turn around.
上述语句指定了一个表达式,该表达式产生了一个布尔值和一个不返回任何结果的代码块(Unit),这正是 while 所期望的。
The arguments above specify an expression that yields a boolean value and a block of code that returns nothing (Unit), which is exactly what while expects.
You've got a loop, you've got a condition and a boolean to check if he's touching the edge, and some statements to tell him to shout or to actually turn around.
我们有一个循环,通过一个条件和一个布尔值来判断,是否触到了边缘,还有一些语句,让它回头并咆哮。
应用推荐