aboutsummaryrefslogtreecommitdiffstats
path: root/docs/types.rst
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-03-14 22:43:27 +0800
committerchriseth <c@ethdev.com>2016-03-14 22:43:38 +0800
commita762694f1d96e1f39e8c8a0e523101bfa46e8355 (patch)
tree916c32bba214c73f76fbf8a2adda5aabeba7bf5c /docs/types.rst
parent11d67369bd0faee2b84c94522355ac963d726f16 (diff)
downloaddexon-solidity-a762694f1d96e1f39e8c8a0e523101bfa46e8355.tar.gz
dexon-solidity-a762694f1d96e1f39e8c8a0e523101bfa46e8355.tar.zst
dexon-solidity-a762694f1d96e1f39e8c8a0e523101bfa46e8355.zip
Allocating arrays.
Diffstat (limited to 'docs/types.rst')
-rw-r--r--docs/types.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 13e2a23e..a669c2d8 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -291,6 +291,23 @@ So `bytes` should always be preferred over `byte[]` because it is cheaper.
that you are accessing the low-level bytes of the utf-8 representation,
and not the individual characters!
+.. index:: ! array;allocating, new
+
+Allocating Memory Arrays
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Creating arrays with variable length in memory can be done using the `new` keyword:
+
+::
+
+ contract C {
+ function f(uint len) {
+ uint[] a = new uint[](7);
+ bytes b = new bytes(len);
+ }
+ }
+
+
.. index:: ! array;length, length, push, !array;push
Members