Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a pass statement in Lua like in python

Tags:

lua

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
like image 852
Prashant Gaur Avatar asked Nov 12 '13 10:11

Prashant Gaur


People also ask

Is pass a statement in Python?

Python pass StatementThe pass statement is used as a placeholder for future code. When the pass statement is executed, nothing happens, but you avoid getting an error when empty code is not allowed.

Do nothing commands python?

pass is a special statement in Python that does nothing. It only works as a dummy statement. We can use pass in empty while statement also. We can use pass in empty if else statements.

Which statement in Python is used when a statement is required syntactically but we do not want any communication or code to execute?

The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute. It is like null operation, as nothing will happen is it is executed. Pass statement can also be used for writing empty loops.


1 Answers

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
like image 113
Yu Hao Avatar answered Sep 28 '22 17:09

Yu Hao