I was working with constant variables in a contract
contract X{
uint constant var1=now;
uint var2=now;
function checkConstant() returns(uint,uint){
return (var1,var2);
}}
I was wondered each time I call checkConstant(..) , the return value of var1 was different but value of var2 was same.
So, I do not understand when I declare a variable as constant why it gets initialised each time a function is invokend, ideally it should get an initial value at time of contract deployment and maintain this value throughout life of contract.
callthe function without transactions and get the return value. But of course with transfer this is a whole other thing. – Roland Kofler Aug 11 '16 at 10:28