min() and array

Richard Gaskin ambassador at fourthworld.com
Thu May 5 12:45:16 EDT 2016


Mike Bonner wrote:

 > You're only looking at a single value, so its returning it.

D'oh!  Yes, now that I've had my coffee that makes perfect sense.

 > To get the minimum value across array entries you need to iterate
 > through them.

The Dict says:

    The ability to use an array was introduced in version 1.1.
    In previous versions, only lists of numbers could be used
    with the min function.

Is that not the case?

This seems to work here, and satisfies Ludovic's request to work on a 
second-level array (here putting "v" in quotes to make it more 
explicitly clear that it's not a variable itself but a single string, 
something apparently missed in earlier posts in this thread, as you noted):

on mouseUp
    repeat with i=1 to 5
       put 10 + i into tarray["v"][i]
    end repeat
    put min(tarray["v"])
end mouseUp

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com





More information about the use-livecode mailing list