开发者

scheme and if condition

开发者 https://www.devze.com 2022-12-09 03:03 出处:网络
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\" F

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

精彩评论

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