I think I need a second pair of eyes to take a look at this as I can't see what I'm doing wrong :-(
I'm trying to get the bigesst value using a simple function, but the results are not what I'm expecting.
Here is the code...
pragma solidity ^0.4.21;
contract GetBiggest {
uint public val1 = 1;
uint public val2 = 2;
uint public val3 = 3;
uint public val4 = 0;
function getBiggestValue() public view returns(uint) {
uint x = val1;
if(x < val2) {
x = val2;
}
if(x < val3) {
x = val3;
}
if(x < val4) {
x = val4;
}
}
}
I'm expecting the value of 3 to be returned when I call the function, but I get 0
What's up with this?
thanks
return
statement??? I wonder how this code even compiles... – goodvibration Apr 30 '18 at 9:32