November 2018
Intermediate to advanced
528 pages
13h 21m
English
In the CRUD pattern, the READ operation expresses the action of retrieving, searching, or viewing existing entries. Correspondingly, we define the findPlayer method in the Cplayer contract to read the mapping records based on the primary key (player address) specified as an argument:
function findPlayer(address _address) public view returns (string, uint, address) { return (players[_address].name, players[_address].PhoneNumber, players[_address].Paddress);}This simple, magical function will directly access a player's details, by providing only its address without the need of looping through the mapping. Moreover, as you may have noticed, Solidity enables us to return multiple values for a function.
Similarly, if we suppose that ...
Read now
Unlock full access