3 ms·
While looking into this, TIL bc is very scriptable: $ bc define fact_rec (n) { if (n < 0) { print "oops"; halt; } if (n < 2) retur
by therein 7y ago
While looking into this, TIL bc is very scriptable:
$ bc
define fact_rec (n) {
if (n < 0) {
print "oops";
halt;
}
if (n < 2) return 1;
return n*fact_rec(n-1);
}
fact_rec(5)
120