Notifications
Clear all

[Closed] GetMinVal?

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.

4 Replies
1 Reply
(@zeboxx2)
Joined: 11 months ago

Posts: 0

Yes

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 )

 eek

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

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.