Skippy le Grand Gourou
Skippy le Grand Gourou

Reputation: 7724

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) ?

Upvotes: 0

Views: 512

Answers (1)

wizzwizz4
wizzwizz4

Reputation: 6426

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.

Upvotes: 3

Related Questions