View Full Version : GetMinVal?
thatoneguy 04-29-2008, 07:09 PM Is there a GetMin A B function built into max that I can't find the name for?
Here is how I'm doing it now:
fn getMinVal VarA VarB =
(
try
(
if VarA > VarB then
(
return VarB
)
else
(
return VarA
)
)
catch()
)
But it seems like there should be a built in function for returning a max or min value.
|
|
Put the values in an array and sort it.
test = #(10,20)
(sort test)[1]
You can also but them in an array and use the amin and amax commands to get the max or min values.
test = #(10,20)
minVal = amin test
-bnvm
ZeBoxx2
04-29-2008, 08:11 PM
Is there a GetMin A B function built into max that I can't find the name for?
Yes
But it seems like there should be a built in function for returning a max or min value.
There is :)
amin val1 val2 .. valN
amax val1 val2 .. valN
-- OR
amin #(val1,val2,..,valN)
amax #(val1,val2,..,valN)
I prefer the latter form :)
( P.S. Help > Search > "minimum value" -> Array Values )
thatoneguy
04-29-2008, 09:05 PM
Ahhhhhhh it's under array. I knew it had to exist somewhere.
(aMin 25 36)
returns: 25
Perfect!
That should be added as a link to Number Methods and Operators.
CGTalk Moderation
04-29-2008, 09:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.