Operation
op is the language’s main computing instruction. Add two numbers, compare them, take
a remainder, find the angle between two points, roll a die — all of that is one instruction
with forty-five operations inside it.
It is always built the same way: where to put it, what to do and with what — with one number or with two. The operation is chosen from a list, and it decides whether the block shows a second field: sine and absolute value have none at all.
The main thing to accept straight away: one operation per line. Expressions like
(a + b) * 2 do not exist in mlog — they unfold into several lines with an intermediate
variable. That is not a limitation of the editor, it is how the language is built.
The full list of operations is in the reference.
Lessons
Section titled “Lessons”- ArithmeticAdd, subtract, multiply, divide — and what to do when there are two operations
- Whole numbers and precisionHow to get a whole number and a remainder, and what to expect from fractions
- Comparisons and logicA comparison is a number too, and it can be worked with like one
- Bitwise operationsA number as a set of bits: masks, shifts, and why shifting by 64 changes nothing
- Angles and distancesThe distance to a point, the angle to it and the difference between two angles — three operations everybody needs
- Randomness and noiseTwo operations about unpredictability: one different every time, the other smooth
What you need first
Section titled “What you need first”Nothing beyond knowing what a variable is. If the word “variable” is unfamiliar, start with «How the processor works».
Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.