is there a pass statement in Lua like in python

2020-03-12 05:43发布

问题:

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

回答1:

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