Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 will be executed and I want to do nothing at z, just same as pythons "pass"

like image 932
Hellnar Avatar asked Mar 13 '26 12:03

Hellnar


1 Answers

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)
like image 165
eljenso Avatar answered Mar 17 '26 04:03

eljenso



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!