- Lua Quick Start Guide
- Gabor Szauer
- 110字
- 2021-08-05 10:30:41
Operator precedence
Much like math, Lua has the concept of operator precedence. In math, 5 + 2 * 10 equals 25 because multiplication happens before addition. Lua behaves the same way; it even uses parentheses to prioritize one group of equations before another. To see this in action, try running the following code snippet:
print ( 5 + 2 * 10 ) -- prints 25
print ( (5 + 2) * 10 ) -- prints 70
Take note of how the output is different; this is because Lua follows mathematical precedence for arithmetic operators. Order of precedence is listed in this table from higher priority (first row) to lower priority (last row):

推薦閱讀
- JavaScript從入門到精通(微視頻精編版)
- Moodle Administration Essentials
- GeoServer Cookbook
- Building a Game with Unity and Blender
- Microsoft Application Virtualization Cookbook
- Interactive Data Visualization with Python
- PHP+MySQL網站開發技術項目式教程(第2版)
- Python 3網絡爬蟲實戰
- Full-Stack Vue.js 2 and Laravel 5
- Visual Basic程序設計實驗指導(第二版)
- 深入淺出Go語言編程
- Building Serverless Architectures
- Machine Learning for Developers
- Python Programming for Arduino
- Python Web自動化測試設計與實現