Pick object that is nearest to axis

Is it possible to pick an instance of an object that is nearest to a specific axis (for example, y), instead of a specified position?

I dunno if this could help you, but here what I did was to pick the nearest block to the X axis (so 0) and the Y of the block itself


and it does indeed eliminate every block in order.
Of course if you wanted to do the same thing with the Y axis, you just put Block.X() and 0 as the Y

I’m not aware of a simple expression. I’m imagining that the target Y is similar to a finish line. You could use a for each object to compare the distance between each object. I used abs() to get the closest to Y() regardless of which side of the line the object was on. I added a final pick random object on the unlikely but not impossible chance of multiple objects having the same Y().

I added a mouse touch to trigger it and a change angle to make it visual for testing.