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

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');
主站蜘蛛池模板: 左贡县| 灌阳县| 吉林省| 沙湾县| 柞水县| 禄丰县| 八宿县| 大理市| 茌平县| 营口市| 嘉义县| 乌什县| 铜梁县| 五大连池市| 穆棱市| 长武县| 萨嘎县| 平凉市| 油尖旺区| 从化市| 怀远县| 宣恩县| 新野县| 静宁县| 荔波县| 榕江县| 通山县| 固原市| 岫岩| 惠安县| 碌曲县| 海伦市| 门源| 宁海县| 辉南县| 三明市| 蓬安县| 肇东市| 永年县| 天台县| 高清|