diff options
author | Araq <rumpf_a@web.de> | 2014-01-19 16:54:59 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-19 16:54:59 +0100 |
commit | 73c6efdf66dd62370cb04f7ce75640743905edc5 (patch) | |
tree | 5ffe8181b782134db74b439fedca073536f3a9f4 /doc/tut1.txt | |
parent | cde9e5d64421e34d7d844c048213f01c40af5dd7 (diff) | |
download | Nim-73c6efdf66dd62370cb04f7ce75640743905edc5.tar.gz |
'nil' as a statement is deprecated, use an empty 'discard' instead
Diffstat (limited to 'doc/tut1.txt')
-rw-r--r-- | doc/tut1.txt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/tut1.txt b/doc/tut1.txt index 2e7f9d27f..1ba3253c8 100644 --- a/doc/tut1.txt +++ b/doc/tut1.txt @@ -324,12 +324,12 @@ the compiler that for every other value nothing should be done: case n of 0..2, 4..7: echo("The number is in the set: {0, 1, 2, 4, 5, 6, 7}") of 3, 8: echo("The number is 3 or 8") - else: nil + else: discard -The ``nil`` statement is a *do nothing* statement. The compiler knows that a -case statement with an else part cannot fail and thus the error disappears. Note -that it is impossible to cover all possible string values: that is why there is -no such check for string cases. +The empty ``discard`` statement is a *do nothing* statement. The compiler knows +that a case statement with an else part cannot fail and thus the error +disappears. Note that it is impossible to cover all possible string values: +that is why there is no such check for string cases. In general the case statement is used for subrange types or enumerations where it is of great help that the compiler checks that you covered any possible |