Code has been added to clipboard!

Solidity Scoping And Declarations Example 2

Example
pragma solidity ^0.4.0;

contract Cont {
    function func() returns (uint) {
        // baz is initialized implicitly with the value of 0
        uint bar = 5;
        if (true) {
            bar += baz;
        } else {
            uint baz = 10;// will never execute
        }
        return bar;// will return 5
    }
}