Skip to content

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.

  1. ArithmeticAdd, subtract, multiply, divide — and what to do when there are two operations
  2. Whole numbers and precisionHow to get a whole number and a remainder, and what to expect from fractions
  3. Comparisons and logicA comparison is a number too, and it can be worked with like one
  4. Bitwise operationsA number as a set of bits: masks, shifts, and why shifting by 64 changes nothing
  5. Angles and distancesThe distance to a point, the angle to it and the difference between two angles — three operations everybody needs
  6. Randomness and noiseTwo operations about unpredictability: one different every time, the other smooth

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.