1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-28 18:17:11 -07:00

document sum

This commit is contained in:
Connor Olding 2021-08-01 07:09:21 -07:00
parent 687f9adfa8
commit 0b05eaa4b5

9
sh/sum
View File

@ -4,6 +4,15 @@
# YES_DASH
sum() { ### @-
### compute the summation of its arguments without forking processes.
### this relies on the shell's built-in arithmetic operators.
###
### ```
### $ sum 1 2 3
### 6
### ```
###
### **TODO:** consider renaming because sum(1) already exists.
local sum=0
for i; do
: $((sum+=i))