Say I have a smart contract such as:
contact Rabbit {
string public name;
function setName(string n) returns (bool) {
name = n;
return true;
}
}
How can I get the value of name
after having set it? I'm using Truffle. I've tried (where rabbit
is a handle of Rabbit
:
rabbit.name();
This just returns ''
.
Also, how can I get the return value? If I execute setName
I just see the transaction, not the return value. I read somewhere I can use call()
, such as: rabbit.setName.call("barry")
, though it wont save the transaction so it needs ot be call again, without call()
. Have I got this wrong?
Thanks.