Min and max functions


#1

I’ve been using CFML for over 20 years, but I only just learned about min and max, thought i’d share!

min(1,5) // returns 1 
max(1,5) // returns 5



#2

IMO these functions should be enhanced to accept any Comparable type, e.g. Dates, Strings, etc.


#3

What about accepting more than two numbers, or a query column?


#4

That’s already fairly easy with numbers.

dump( [ 8, 2, 4 ].Min() );// 2
q = Query( col1: [ 8, 2, 4 ] );
dump( q.ColumnData( "col1" ).Max() );// 8