Min/max functions

To my big surprise there seem to be no min/max functions. I was expecting something like this:

{{ $a := 1 }}
{{ $b := 2 }}
{{ $c := max $a $b }}

The only work around I see is super ugly (with scratch and if/else).
Anyone got a better suggestion? Or what did I miss?

You could use cond, which should be terser than if-else:

{{ $c := cond (ge $a $b) $a $b }}

5 Likes