You can emit events.
pragma solidity ^0.4.21;
contract ShapeCalculator{
function rectangle(uint256 w, uint256 h) public returns (uint256 s, uint256 p) {
//print value of w and h
emit Width(w);
emit Height(h);
s = w * h;
p = 2 * (w + h);
}
event Width(uint256 w);
event Height(uint256 h);
}
You will see these events generated when the transaction is mined
[
{
"topic": "0xd9fe7dbbe8bd8e307a7710abb04dfbe406ccdc67a6aff083673fc25c8d9bcd47",
"event": "Width",
"args": [
"1"
]
},
{
"topic": "0xff7a085d76b69acdcd09df67f894435c0a628ed4da9d2180e85f4a5b4dbad030",
"event": "Height",
"args": [
"5"
]
}
]
Contract gist
https://gist.github.com/cleanunicorn/500e53b86825c391b9d7947cf0c24d00