parent
5828620d47
commit
8f7a013cc7
1 changed files with 26 additions and 0 deletions
26
tests/concepts/t8558.nim
Normal file
26
tests/concepts/t8558.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
discard """
|
||||||
|
output: '''10
|
||||||
|
9
|
||||||
|
8
|
||||||
|
7
|
||||||
|
6
|
||||||
|
5
|
||||||
|
4
|
||||||
|
3
|
||||||
|
2
|
||||||
|
1
|
||||||
|
go!
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
type Integral = concept x
|
||||||
|
x == 0 is bool
|
||||||
|
x - 1 is type(x)
|
||||||
|
|
||||||
|
proc countToZero(n: Integral) =
|
||||||
|
if n == 0: echo "go!"
|
||||||
|
else:
|
||||||
|
echo n
|
||||||
|
countToZero(n-1)
|
||||||
|
|
||||||
|
countToZero(10)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue