- Lua Quick Start Guide
- Gabor Szauer
- 137字
- 2021-08-05 10:30:36
Printing variables
How can you tell what the value of a variable is? One way is to print the value out to the console. To print the value of a variable, you first type the keyword print, then the name of the variable between parentheses (). The full syntax is:
print (<variable>)
For example, we can check the value assigned to foo with the following code:
foo = "bar"
print (foo)
The first line of code creates a variable named foo and assigns it the string value "bar". The second line prints the value of the foo variable. This means bar will be printed to the console:

Where does the print keyword come from? What's a keyword? Why do we use parentheses when using print? These questions will be answered in the Functions section of this chapter.
推薦閱讀
- Debian 7:System Administration Best Practices
- PyQt從入門到精通
- Mastering Spring MVC 4
- Object-Oriented JavaScript(Second Edition)
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Mastering Apache Maven 3
- Python Data Structures and Algorithms
- Oracle實用教程
- Natural Language Processing with Python Quick Start Guide
- 監控的藝術:云原生時代的監控框架
- JQuery風暴:完美用戶體驗
- Groovy 2 Cookbook
- Mastering Bootstrap 4
- 讓Python遇上Office:從編程入門到自動化辦公實踐
- jQuery Essentials