The Hacker's Language in Action: #2 Beautiful numbers

in software •  7 years ago 

Lua language has a delicate treatment for mathematical operations in order to simplify your life.

portada_lua.png

Arithmetic operators

lua_arithmetics.png

note difference type vs math.type

Exponentiation and useful modulo

lua_useful_modulo.png

Basics maths functions

lua_basics_maths.png

Precedence

NoDescription
1^
2unary operators (-, ~, #, not)
3/, //, *, %
4+, -
5.. (concatenation)
6<<, >> (bitwise shifts)
7& (bitwise AND)
8~ (bitwise exclusive OR)
9▏(bitwise OR)
10<, >, <=, >=, ==, ~=
11and
12or

References

  • Roberto Ierusalimschy, Programming in Lua, Fourth Edition.
  • lua.org

Previous post

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

hey sorry to go off topic, i needed some help with steem python ,r u der on discord or steemit chat?

Hi, i'm sorry (long time), i'm reading about steem python, what happen?

on steem chat i'm @jicer