Update tut1.txt
This commit is contained in:
parent
3772944fdb
commit
abe1051374
1 changed files with 4 additions and 0 deletions
|
|
@ -758,9 +758,13 @@ However, this cannot be done for mutually recursive procedures:
|
||||||
proc even(n: int): bool
|
proc even(n: int): bool
|
||||||
|
|
||||||
proc odd(n: int): bool =
|
proc odd(n: int): bool =
|
||||||
|
if n == 0:
|
||||||
|
true
|
||||||
n == 1 or even(n-1)
|
n == 1 or even(n-1)
|
||||||
|
|
||||||
proc even(n: int): bool =
|
proc even(n: int): bool =
|
||||||
|
if n == 1:
|
||||||
|
true
|
||||||
n == 0 or odd(n-1)
|
n == 0 or odd(n-1)
|
||||||
|
|
||||||
Here ``odd`` depends on ``even`` and vice versa. Thus ``even`` needs to be
|
Here ``odd`` depends on ``even`` and vice versa. Thus ``even`` needs to be
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue