Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

For example - Arrays with named indexes or hashes. Something like PHP code;

$array = array(

"foo" => "some foo value",

"bar" => "some bar value",);

Thanks

1 Answer

0 votes
by (29.5k points)

There is something similar to what you're looking for it is a type called mapping:

contract MappingExample {
    mapping(address => uint) public balances;

    function update(uint newBalance) {
        balances[msg.sender] = newBalance;
    }
}

you can refer the link below for more details

http://solidity.readthedocs.io/en/develop/types.html#mappings

Browse Categories

...