I am very briefly looking into Scheme and wondering if there is a way to do the following: add several operations to each outcome (#t and #f).
(if (something)
Do something //true, #t
Do one thing AND another thing)) //false, #t
As an example, given a defined procedure that takes an integer x. If it is greater than five --> print out a message. If it is less than five --> print out message AND set x to zero:
(if (> x 5)
"Greater than five"
"Less than or equal to 5", (= x 0))
To rephrase: I am looking for a mechanism that allows me to do the following (expressed in Java syntax):
if (cond) { //true
//Do this
}
else { //false
//Do this
//AND this
}
Aucun commentaire:
Enregistrer un commentaire