struct Rider{
    //address riderAddr;
    uint rider_Id;
    bytes32 Rname;
    bool set;

mapping(address => Rider) public riders;

function registerRider(address _riderAddr, uint _riderId, bytes32 _riderName) public {
    Rider storage rider = riders[_riderAddr];
    //Already registered or not!
    //store rider data record
    riders[_riderAddr] = Rider({
        rider_Id: _riderId,
        Rname: _riderName,
        set: true
  • do you want to find a rider by his id? – Badr Bellaj Aug 20 '19 at 11:46
  • @BadrBellaj - Yes, I want to retrieve the whole list of array in one function viewRiders() first. Thank you very much for any help in advance! – Shalu Aug 20 '19 at 15:41
  • you can't return a mapping in a function !! – Badr Bellaj Aug 20 '19 at 17:42
  • okay.. thank you@Badr Bellaj – Shalu Aug 21 '19 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.