官术网_书友最值得收藏!

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');
主站蜘蛛池模板: 庆元县| 泉州市| 屏山县| 竹山县| 新巴尔虎左旗| 襄城县| 抚松县| 濮阳县| 阳江市| 封开县| 广河县| 准格尔旗| 马龙县| 鱼台县| 南丹县| 寻乌县| 邢台市| 得荣县| 扶沟县| 于都县| 赤城县| 衡东县| 宿迁市| 连山| 夹江县| 乾安县| 肥城市| 镇康县| 普陀区| 灵川县| 突泉县| 三门峡市| 仁布县| 浦东新区| 沐川县| 定边县| 灵丘县| 桃江县| 信宜市| 宽甸| 武乡县|