diff options
author | Araq <rumpf_a@web.de> | 2011-03-24 01:02:19 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-03-24 01:02:19 +0100 |
commit | 368bb3b5e24b555a64584b9cfaa3de6be68b4787 (patch) | |
tree | 011b54bdf57bcd6f3e9cfac0029210002c722f5b /doc | |
parent | 62eb5b124e33966aaf6cc2d012d0c3d6bdd36d0c (diff) | |
parent | 00f0e9927fad0b941e4f98d18f49a3be8373b5c6 (diff) | |
download | Nim-368bb3b5e24b555a64584b9cfaa3de6be68b4787.tar.gz |
Merge branch 'master' of https://github.com/Tass/Nimrod into Tass-master
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manual.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index 67c3c43c7..6240a9147 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -1299,6 +1299,22 @@ algorithm returns true: if b.kind == distinct and typeEquals(b.baseType, a): return true return false +You can, however, define your own implicit converters: + +.. code-block:: nimrod + converter toInt(x: char): int = result = ord(x) + + var + x: int + chr: char = 'a' + + # implicit conversion magic happens here + x = chr + echo x # => 97 + # you can use the explicit form too + x = chr.toInt + echo x # => 97 + Assignment compatibility ~~~~~~~~~~~~~~~~~~~~~~~~ |