Min and max functions

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 Likes

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

3 Likes

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

2 Likes

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
3 Likes