2

The way I understand a scheme if-statement is that the first condition is when the if-statement is true, and the second statement is when it is false. What if I want several conditions for when the statement proves true?

An example:

(if (= a b)
    (set! ([a 2]))  // This shall happen when true
    (set! ([b 4]))  // This shall happen when true

    (set! ([a b])) // This shall happen when NOT true

Is it possible to do something like that?

Aveneon
  • 171
  • 1
  • 10
  • 1
    possible duplicate of [Is there a possibility of multiple statements inside a conditional statement's body?](http://stackoverflow.com/questions/11263359/is-there-a-possibility-of-multiple-statements-inside-a-conditional-statements-b) – Mithrandir May 29 '15 at 14:27

1 Answers1

1

You can try to use begin in an if statement. like so:

(if (something)
(begin (foo)
       (bar)))
padawanMiyagi
  • 116
  • 11