Lua 中有没有像 python 中的 pass 语句 [英] is there a pass statement in Lua like in python

查看:23
本文介绍了Lua 中有没有像 python 中的 pass 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像在 python 中一样,我们有 pass 语句.

<前>定义计算():经过

在 Lua 中有这样的声明吗?我想做

<前>如果连接然后经过

解决方案

pass 在 Python 中什么都不做.在 Lua 中,您可以将其留空:

如果连接则结束

如果需要占位符,请使用空块

if connect then do end end

或者如果在 Lua 5.2 中,使用分号:

if connect then ;结尾

Like in python we are having pass statement.

def calcu():
    pass

in Lua is there any statment like this ? i want to do

if connect then 
    pass

解决方案

pass in Python does nothing. In Lua, you can just leave it empty:

if connect then end

If you want a placeholder, use an empty block

if connect then do end end

or if in Lua 5.2, use a semicolon:

if connect then ; end

这篇关于Lua 中有没有像 python 中的 pass 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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