- Lua Quick Start Guide
- Gabor Szauer
- 85字
- 2021-08-05 10:30:39
Calling a function
Once a function is declared, it can be executed by calling it. To call a function, simply type its name, followed by parentheses. For example, to read input from the console, you call io.read(). The following snippet demonstrates how to declare and call your own function:
print ('about to declare the PrintSomething function');
function PrintSomething() -- declare the function
print ('hello, world')
end
print ('the PrintSomething function is declared');
print ('calling the PrintSomething function');
PrintSomething(); -- call the function
print ('called the PrintSomething function');
推薦閱讀
- Qt 5 and OpenCV 4 Computer Vision Projects
- Visual Basic .NET程序設(shè)計(第3版)
- 國際大學(xué)生程序設(shè)計競賽中山大學(xué)內(nèi)部選拔真題解(二)
- ASP.NET MVC4框架揭秘
- Python高級編程
- 基于差分進化的優(yōu)化方法及應(yīng)用
- 機械工程師Python編程:入門、實戰(zhàn)與進階
- 網(wǎng)絡(luò)爬蟲原理與實踐:基于C#語言
- Java SE實踐教程
- 零基礎(chǔ)學(xué)C語言第2版
- C++標準庫(第2版)
- Hands-On Data Visualization with Bokeh
- Comprehensive Ruby Programming
- Expert Angular
- C#.NET程序設(shè)計