fp.fact = ($n) -> { if($n < 0) { throw fn.withErrorMessage($LANG_ERROR_INVALID_ARGUMENTS, n must be >= 0) } $ret = 1L $i = 2 while($i <= $n) { $ret *= $i $i += 1 } return $ret }