template times(count : uint, statement1, statement2: untyped) =
for i in 0 .. count:
statement1
statement2
times 3[uint] do:
echo "Part 1"
do:
echo "Part 2"
Now I want to extend this with variable number of arguments and so far I have got to this:
timesv2(statements: varargs[untyped]) =
for statement in statements:
statement
I can't seem to be able to use this template:
timesv2 do:
echo "Hello world"
do:
echo "test"
do:
echo "another test"
How can I use this template?
Now I want to pass a generic type to template timesv2 as well.
template timesv2[T](count: T, statements: varargs[untyped]) =
for statement in statements:
statement
How can I call something like a
3[uint]timesv2 do:
#...
do:
#...