Skip to main content
edited tags; edited title
Link
eth
  • 86.5k
  • 53
  • 287
  • 411

How can I instantiate an array of push values to itaddresses?

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}```
 
I simply want to do something that would be analogous to this ruby: 

```arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']```

I dont need the size to be dynamic, and the type is address.
contract C {
    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}

I simply want to do something that would be analogous to this ruby:

arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']

I dont need the size to be dynamic, and the type is address.

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}```
 
I simply want to do something that would be analogous to this ruby: 

```arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']```

I dont need the size to be dynamic, and the type is address.

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

contract C {
    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}

I simply want to do something that would be analogous to this ruby:

arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']

I dont need the size to be dynamic, and the type is address.

edit: added more detail
Source Link
ZMitton
  • 2.8k
  • 4
  • 19
  • 34

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}```
 
I simply want to do something that would be analogous to this ruby: 

```arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']```

I dont need the size to be dynamic, and the type is address.

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}```
 

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}```
 
I simply want to do something that would be analogous to this ruby: 

```arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']```

I dont need the size to be dynamic, and the type is address.
Source Link
ZMitton
  • 2.8k
  • 4
  • 19
  • 34
Loading