如何在elisp'if'语句中编写多个语句? [英] How can you write multiple statements in elisp 'if' statement?

查看:90
本文介绍了如何在elisp'if'语句中编写多个语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在elisp中,有一种'if'情况,我想执行许多不同的事情:

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

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

但是,(do-something-else)仅在else情况下执行。您如何指定要执行的指令块?例如:

However, (do-something-else) is executed in the else-case only. How can you specify a block of instructions to execute? For example:

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


推荐答案

使用 progn

(if condition
    (progn
        (do-something)
        (do-something-else)))

这篇关于如何在elisp'if'语句中编写多个语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆