Make add, sub, mul handle no arguments
This commit is contained in:
parent
530e740de0
commit
045db2abec
3 changed files with 6 additions and 3 deletions
3
add.nim
3
add.nim
|
|
@ -2,6 +2,7 @@ import cligen, sequtils
|
|||
import common
|
||||
|
||||
proc main(integers:seq[int]) =
|
||||
echo integers.foldl(a + b)
|
||||
if integers.len > 0:
|
||||
echo integers.foldl(a + b)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
3
mul.nim
3
mul.nim
|
|
@ -2,6 +2,7 @@ import cligen, sequtils
|
|||
import common
|
||||
|
||||
proc main(integers:seq[int]) =
|
||||
echo integers.foldl(a * b)
|
||||
if integers > 0:
|
||||
echo integers.foldl(a * b)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
3
sub.nim
3
sub.nim
|
|
@ -2,6 +2,7 @@ import cligen, sequtils
|
|||
import common
|
||||
|
||||
proc main(integers:seq[int]) =
|
||||
echo integers.foldl(a - b)
|
||||
if integers > 0:
|
||||
echo integers.foldl(a - b)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue