Cannot write functions with variable argument count
It appears to only be possible to define functions with a fixed number of arguments.
Perhaps the simplest solution would be some basic polymorphism. Example:
fn doStuff a b
echo a: $a, b: $b
end
fn doStuff a
doStuff $a "not_specified"
end
doStuff "test"
# "a: test, b: not_specified"
Or, perhaps cleaner, argument expansion:
fn printSection label ...list
echo -e "\n\n$label:"
for item in @list
echo "- $item"
end
end
printSection todo "type foo" "make bar"
# todo:
# - type foo
# - make bar
Edited by Zach Button