You can conditionally select an index within geometry nodes just as you are doing. You could send this selection that you have, via your math node, to any number of operations that operate on selections. What you cannot do is send a selection to the switch input of a switch node.
You say you're from a programming background. Cool, nodes are just a graphical programming language. Switch is a function. We can write it out in pseudocode if we want:
geometry Switch(bool Condition geometry outputIfFalse geometry outputIfTrue) {
if Condition return outputIfTrue else return outputIfFalse; }
That's really simple, right? It doesn't do any mixing between the geometry. It doesn't join. It's not overloaded with a bunch of specific cases in case we send it different types of parameters.
You have a variable called DuplicateIndex. This variable is an array of integers. Because you have two instances, this is an array of size 2.
"Less than" is another function. This is an overloaded function that can take multiple kinds of inputs. It can take an array as an input, in which case it outputs an array of booleans; or, it can take just a float or integer or something, in which case it outputs a single boolean. We are sending it an array, so it is outputting an array as well.
But we can't call switch with an array parameter for its boolean input! There's not any way to reasonably cast an array of booleans to a boolean. Our compiler throws an error. In this case, that warning manifests as the red line from result to switch input, indicating GN's version of a type mismatch.
What would we do if we want only the instances with an index less than six? (Which is all of them.) We might call Separate Geometry. Here is roughly what that does, in my pseudocode:
geometry SeparateGeo (geometry InputGeo, array of booleans Selection) {
geometry OutputGeo = InputGeo.duplicate();
for which in Selection {
if (not which) OutputGeo.delete(OutputGeo.points[which]);}
return OutputGeo;
}
Separate Selection is a loop of conditionals. Most GN operations are loops, and anything with a "selection" input is a conditional. Unlike Switch, it accepts an array of booleans as an input. If you want to send something an array of booleans, you can use it, and you can't use Switch.