top | item 24232158

(no title)

forth_fool | 5 years ago

Talking about obscurity of code, in Forth you would write:

  5 9 7 min max .
This prints 7, as it's between 5 (lower bound) and 9 (upper bound).

Defining a clamp "function" looks like this:

  : clamp ( min max n -- clamped_n )
    min max ;

discuss

order

No comments yet.