void type for generics

This commit is contained in:
Araq 2011-07-31 01:11:34 +02:00
commit 00da785f5d
5 changed files with 27 additions and 13 deletions

View file

@ -0,0 +1,13 @@
discard """
output: "he, no return type; a string"
"""
proc ReturnT[T](): T =
when T is void:
echo "he, no return type;"
else:
result = " a string"
ReturnT[void]()
echo ReturnT[string]()