Frequent contributor Argle found some code written at his current company a "long time ago", but unfortunately in a galaxy far too close to our own.

If rsRecordSetD1T3("ItemState")<>"N" then Select Case rsRecordSetD1T3("ItemState") Case "R", "L" tally=tally+1 Case "B" tally=tally+2 Case "N" tally=tally+0 Case Else tally=tally+0 End SelectEnd If

We start with an If: only enter this branch if ItemState is definitely not equal to "N". Then we enter a switch.

If ItemState is "R" or "L", we add one to tally. If it's "B", we add two. If it's "N", we add zero, and wait, we need to pause here a moment.

First, we know it can't possibly be "N". We just checked that above. But then, we also… add zero. Which is effectively a no-op, at least in terms of its impact on program state.

And then, in a Case Else, e.g. for all other values, we also add zero.

This is very much the kind of code that "evolved". Probably, at one point, case "N" and the else actually did something. Then the if-not-equal branch was added. But then someone else decided to make "N" do nothing, but wasn't confident enough to remove it. Then someone else did the same on the Else. Reading this code is like being a paleontologist finding a tooth and extrapolating from that an entire living creature.

In this case, that creature is a beast that hopefully goes extinct soon.

[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.