Select
select is a jump that jumps nowhere. Its condition is the same, and instead of jumping it
puts one of two values into a variable: the first if the condition holds, the second if not.
The line reads as words, and in the game that is how it is written:
total = if copper >= 100 then 1 else 0.
The group is small: the instruction does exactly one thing, and the whole conversation is about
when it is appropriate. Not always: if the choice is between one and zero, the comparison in
op gives the answer by itself, and select there is redundant.
Lessons
Section titled “Lessons”- Choosing a value without a branchA branch for the sake of one value is unnecessary — but select is not always needed either: a comparison already has an answer
What you need first
Section titled “What you need first”«Condition and branching» — that is where the conditions and their
labels in the blocks are covered, and select takes exactly the same ones.
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.