- 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');
推薦閱讀
- Getting Started with Citrix XenApp? 7.6
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- C# 2012程序設(shè)計實踐教程 (清華電腦學(xué)堂)
- Clojure Reactive Programming
- C語言程序設(shè)計教程
- Visual Basic程序設(shè)計實驗指導(dǎo)(第二版)
- Unity UI Cookbook
- 微服務(wù)從小白到專家:Spring Cloud和Kubernetes實戰(zhàn)
- 響應(yīng)式架構(gòu):消息模式Actor實現(xiàn)與Scala、Akka應(yīng)用集成
- Visual Basic 程序設(shè)計實踐教程
- Go Systems Programming
- Java 11 and 12:New Features
- C語言程序設(shè)計
- Manage Your SAP Projects with SAP Activate
- Apache Kafka 1.0 Cookbook