Is there a way that I can print the intermediate result on a console or some log file in order to debug my contract?
1 Answer
you could use events to debug(log) the desired variable.Please read the official documentation to get more details.
e.g :
pragma solidity ^0.4.0;
contract test {
event test_value(uint256 indexed value1);
uint256 value_test;
function test_f() {
//value_test processing
test_value(value_test); // log the current value
}
}
an alternative solution is to use the remix (browser solidity) debugger :
-
1