How to find the largest of 4 numbers

I've been trying to make a code that casts 4 rays, takes the length of those 4 rays, and then determines what the longest one is. However, in order to do that I would need to find the largest of 4 numbers. Any ideas on how to do that?

We actually have a hidden MAX function that does what you want. Grab a dyadic (two-input) numeric operator such as + from the palette to the scripting area, then right-click on it and choose the "relabel" option. Then in the menu that appears, you can do this:
untitled script pic
using four explicit input slots, or you can drag a list over the right arrow to accept a list of any length:
untitled script pic (1)

Just use this
untitled script pic

The block is hidden behind relable. Right click any math reporter (+, -, etc), then click relable. There's a block called max, click that.
max reporter

To get what I have, drag a list or a reporter onto the black arrow, and when there's a red halo, drop it.

red halo

Great, thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.