RosettaCodeData/Task/Factorial/Friendly-interactive-shell/factorial-2.fish

9 lines
116 B
Fish
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
function factorial
set x $argv[1]
if [ $x -eq 1 ]
echo 1
else
expr (factorial (expr $x - 1)) '*' $x
end
end