summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2016-08-03 15:45:50 +0200
committerArne Döring <arne.doering@gmx.net>2016-08-03 15:45:50 +0200
commitac84a87925b3ffc433ef22f3136714d7f96af35d (patch)
tree0e1300290b6bae0662dcab77169cacad91093941
parent6bbb25f2d7be66b67545c7d52b8f7f67ad56f88f (diff)
downloadNim-ac84a87925b3ffc433ef22f3136714d7f96af35d.tar.gz
updadet doc/manual array construction syntax
-rw-r--r--doc/manual/syntax.txt6
-rw-r--r--doc/manual/types.txt6
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/manual/syntax.txt b/doc/manual/syntax.txt
index 4f7483be8..74bf7e3c9 100644
--- a/doc/manual/syntax.txt
+++ b/doc/manual/syntax.txt
@@ -19,10 +19,8 @@ other binary operators are left-associative.
   proc `^/`(x, y: float): float =
     # a right-associative division operator
     result = x / y
-  echo 12 ^/ 4 ^/ 8 # 24.0 (4 / 8 = 0.5, then
-                           12 / 0.5 = 24.0)
-  echo 12  / 4  / 8 # 0.375 (12 / 4 = 3.0, then
-                              3 / 8 = 0.375)
+  echo 12 ^/ 4 ^/ 8 # 24.0 (4 / 8 = 0.5, then 12 / 0.5 = 24.0)
+  echo 12  / 4  / 8 # 0.375 (12 / 4 = 3.0, then 3 / 8 = 0.375)
 
 Precedence
 ----------
diff --git a/doc/manual/types.txt b/doc/manual/types.txt
index 4c015ffb7..b50da584d 100644
--- a/doc/manual/types.txt
+++ b/doc/manual/types.txt
@@ -435,7 +435,9 @@ has the same type. Arrays always have a fixed length which is specified at
 compile time (except for open arrays). They can be indexed by any ordinal type.
 A parameter ``A`` may be an *open array*, in which case it is indexed by
 integers from 0 to ``len(A)-1``. An array expression may be constructed by the
-array constructor ``[]``.
+array constructor ``[]``. The element type of this array expression is
+inferred from the type of the first element. All other elements need to be
+implicitly convertable to this type.
 
 Sequences are similar to arrays but of dynamic length which may change
 during runtime (like strings). Sequences are implemented as growable arrays,
@@ -460,6 +462,8 @@ Example:
   x = [1, 2, 3, 4, 5, 6]  # [] is the array constructor
   y = @[1, 2, 3, 4, 5, 6] # the @ turns the array into a sequence
 
+  let z = [1.0, 2, 3, 4] # the type of z is array[0..3, float]
+
 The lower bound of an array or sequence may be received by the built-in proc
 ``low()``, the higher bound by ``high()``. The length may be
 received by ``len()``. ``low()`` for a sequence or an open array always returns