Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
(define (number n) (cond [(< n 10) 5.0] [(< n 20) 5] [(< n 30) true]))
我将如何在末尾添加 else 语句?
[else false])
谢谢。
像这样:
(define (number n) (cond [(< n 10) 5.0] [(< n 20) 5] [(< n 30) true] [else false]))
请记住 -else子句(如果存在)必须是cond表格中的最后一个子句。如果它没有被明确写入并且没有任何条件成立,则#<void>返回。
else
cond
#<void>