开发者

scheme and if condition

I want to return nothing when if condition is not met, for instance

(if x y z)

so if x is not met, z w开发者_如何学编程ill be executed and I want to do nothing at z, just same as pythons "pass"


From R5RS:

syntax: (if test consequent alternate)

syntax: (if test consequent)

Semantics: An if expression is evaluated as follows: first, test is evaluated. If it yields a true value (see section 6.3.1), then consequent is evaluated and its value(s) is(are) returned. Otherwise alternate is evaluated and its value(s) is(are) returned. If test yields a false value and no alternate is specified, then the result of the expression is unspecified.

So your if expression becomes:

(if x y)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜