I wrote a function that takes three arguments and assigns the data to 3 public variables. This is the code in .sol file
uint[] public rule1;
uint cond1;
string name1;
function setRule (string _name, uint _cond, uint[] _rule) public {
for (uint i = 0; i < _rule.length; i++) {
rule1[i] = _rule[i];
}
name1 = _name;
cond1 = _cond;
}
After compiling and running the contract in geth CLI. I am checking the following commands.
token.rule1[0]
returns 0
token.setRule("my rule", 1, [1,2,3])
Tx is mined
token.rule1(0)
returns 0
token.name1
returns ""
token.rule1[1]
returns 0
I want to assign the values passed in arguments to the public variables. How to do it?