Search code examples
schemegimpscript-fu

Can't figure how to set two variables in a single IF statement


I'm trying to write my first Gimp script, but I can't seem to get it set two variables in a single IF statement :

(if
  (< a b)
  ((set! a 100)(set! b 200))
  ((set! a 200)(set! b 100))
)

I get an illegal function error. It works if I set a single variable. How should I write it to work with two (or more) ?


Solution

  • You forgot begin:

    (if
      (< a b)
      (begin (set! a 100) (set! b 200))
      (begin (set! a 200) (set! b 100))
    )
    

    begin basically just executes all of its arguments.