首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ELisp:如何在'else'块中执行多个表达式?

在ELisp中,可以使用progn来在else块中执行多个表达式。progn是一个特殊的表达式,它允许你在一个单独的表达式中组合多个表达式。这是一个示例:

代码语言:lisp
复制
(if (> 10 5)
    (progn
      (print "10 is greater than 5")
      (print "This is the second expression in the progn block"))
  (progn
    (print "10 is not greater than 5")
    (print "This is the second expression in the else block")))

在这个示例中,我们使用if语句来检查10是否大于5。如果是,我们使用progn来执行两个表达式:打印"10 is greater than 5"和"This is the second expression in the progn block"。如果不是,我们使用else块中的progn来执行两个表达式:打印"10 is not greater than 5"和"This is the second expression in the else block"。

这个示例展示了如何在ELisp中在else块中执行多个表达式。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

2分7秒

基于深度强化学习的机械臂位置感知抓取任务

领券