How can you write multiple statements in elisp 'if' statement?

后端 未结 2 964
走了就别回头了
走了就别回头了 2021-01-30 12:12

In elisp, there is an \'if\' case where I would like to perform many different things:

(if condition
    (do-something)
    (do-something-else)
    ...)
<         


        
2条回答
  •  野性不改
    2021-01-30 12:58

    If there's no else required, it might be more readable to use:

    (when condition
        (do-something)
        (do-something-else))
    

    And, there's the converse

    (unless (not condition)
        (do-something)
        (do-something-else))
    

    Check out the Emacs Lisp manual for conditionals.

提交回复
热议问题