像Python一样在Lua中有通过语句 [英] is there a pass statement in Lua like in python

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

问题描述

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

Like in python we are having pass statement.


def calcu():
    pass

卢阿(Lua)中有这样的陈述吗? 我想做

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


if connect then 
    pass

Python中的

推荐答案

pass不执行任何操作.在Lua中,您可以将其保留为空:

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

或在Lua 5.2中使用分号:

or if in Lua 5.2, use a semicolon:

if connect then ; end

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

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