proc hello() =
echo "Hello"
hello() #调用函数必须在函数定义的下方使用
proc hello2(name: string) =
echo name
hello2("John")# John
proc sum(num1, num2: int): int =
result = num1 + num2
echo sum(1,5) # 6
proc multiSum(numbers: varargs[int]): int =
for n in numbers:
result += n
echo multiSum(1,2,3,4) # 10