Re: minimum function?
Re: minimum function?
- Subject: Re: minimum function?
- From: Rob Stott <email@hidden>
- Date: Tue, 5 Apr 2005 21:53:29 +0100
Spooky... that's almost what I said... ;-)
I'm confused about why this script doesn't fall over with a 'list'
containing just one item though.
r.
On 5 Apr 2005, at 21:40, Mark J. Reed wrote:
No need to do that; what happens if all the values are > 2^512?
Unlikely, but not impossible. :)
Just start out with it set to the first one and loop through the rest:
on min(theList)
set minVal to theList's item 1
repeat with i from 2 to count theList
if theList's item i < minVal then
set minVal to theList's item i
end if
end repeat
return minVal
end min
Then you can call that anywhere else in your code like so:
set smallest to min({5,8,17,23,6});
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden