Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Elisp syntax - block of commands

7 views
Skip to first unread message

Benny Simonsen

unread,
Jul 23, 2007, 5:41:49 AM7/23/07
to

Hey

I have a simple question,

I want to execute two commands if an if evaluates to true:

(if (equal "1" "1")
{
(true_comand 1)
(true_command 2)
}
(false_command)
)

But the {} don't give a "block".
How is it done in elisp?

/Benny

Mark Harrison

unread,
Jul 25, 2007, 9:05:36 PM7/25/07
to

Use progn:

(if (equal "1" "1")

(progn (true-command-1)
(true-command-2))
(false-command))

steve gonedes

unread,
Apr 25, 2021, 11:46:14 AM4/25/21
to
a more complex form is called COND.

(cond ((equal "1" "1")
(true-command x)
(true-command2 x))
(t
(false-command)))

0 new messages