fixed typo ':' instead of ','
This commit is contained in:
parent
287839ce03
commit
a7de40ae56
4 changed files with 1130 additions and 245 deletions
|
|
@ -155,7 +155,7 @@ More Code!
|
|||
echo decimalToRoman(1009) # MIX
|
||||
|
||||
|
||||
- ``{"M": 1000, "CM": 900}`` sugar for ``[("M": 1000), ("CM": 900)]``
|
||||
- ``{"M": 1000, "CM": 900}`` sugar for ``[("M", 1000), ("CM", 900)]``
|
||||
- ``result`` implicitly available
|
||||
|
||||
|
||||
|
|
@ -236,6 +236,8 @@ Operators
|
|||
* No explicit distinction between binary and unary operators:
|
||||
|
||||
.. code-block:: Nim
|
||||
:number-lines:
|
||||
|
||||
proc `++`(x: var int; y: int = 1; z: int = 0) =
|
||||
x = x + y + z
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ Code coverage
|
|||
# This is the code our macro will produce!
|
||||
|
||||
var
|
||||
track = [("line 9", false), ("line 13", false), ...]
|
||||
track = [("line 11", false), ("line 15", false), ...]
|
||||
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
|
|
|
|||
1348
livedemo/demo.html
1348
livedemo/demo.html
File diff suppressed because it is too large
Load diff
|
|
@ -1,22 +1 @@
|
|||
|
||||
import macros
|
||||
|
||||
macro cov(n: untyped): untyped =
|
||||
result = n
|
||||
echo treeRepr n
|
||||
|
||||
cov:
|
||||
proc toTest(x, y: int) =
|
||||
try:
|
||||
case x
|
||||
of 8:
|
||||
if y > 9: echo "8.1"
|
||||
else: echo "8.2"
|
||||
of 9: echo "9"
|
||||
else: echo "foo"
|
||||
echo "no exception"
|
||||
except IoError:
|
||||
echo "IoError"
|
||||
|
||||
toTest(8, 10)
|
||||
toTest(10, 10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue