Luckily, NetLogo has lots of built-in commands (called "primitives") that do for us many of the things that typical programming courses lead us to believe require building arrays and looping with FOR and WHILE. Commands like (as Wade points out) "max-one-of" that returns a patch that has the maximum value for an expression.
Besides MIN-ONE-OF and MAX-ONE-OF, that return an AGENT with the minimum or maximum value, there's also plain-old MIN and MAX that return the VALUE from a list.
They go along with OF, which when given an agentset, returns a list of VALUEs.
;; patch with biggest value (if a tie, chooses on at random)
PRINT MAX-ONE-OF [ PXCOR + PYCOR ] PATCHES
;; biggest value from the patches
PRINT MAX [ PXCOR + PYCOR ] OF PATHES
If you are concerned about execution speed, you may need to put thought into how to reduce the total number of operations. But remember to always test any theory of what might be faster.
~~James
TurtleZero