Hone

Lessons · Industrial control · one coil, one rung

One coil, one rung

If either condition should drive the output, that is a branch. If both must, that is series. Either way it is one rung.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

It makes the program mean what it says, and it makes the next person's cross-reference honest.

How to think about it

Merge, do not delete blindly: both conditions were put there by somebody who wanted them. Work out whether they are an OR or an AND, write the one rung, and remove the dead one so nobody edits it expecting an effect.

Worked example

{ [A] | [B] } (Lamp)
Either one lights it. A on, B off. Lamp: 1
[A] [B] (Lamp)
Both required. A on, B off. Lamp: 0

Your turn

Either condition should light the lamp. Join them.

{ [A]  [B] } (Lamp)

The trap

Leaving the dead rung in place because 'it works now' hands the next person a rung that cannot do anything and looks like it can.

Practise one coil, one rung on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.