codedamn

Mappings Struct

Created by Kshitij about a year ago

0

No description provided

8 Comments

    0

    is there any difference between declaring struct outside contract and inside contract?

    @ladeed

    Muhammed Ladeed

    @ladeed

    0

    This content was deleted by the author

    @shiyasmohd

    Shiyas Mohammed

    @shiyasmohd

    0
        data[roll]=Student({name:_name,dep:_dep,year:_year}); //this method works fine, the method in the video is showing error
    
    @shiyasmohd

    Shiyas Mohammed

    @shiyasmohd

    0

    // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0;

    contract Day3 {

    mapping(address => uint256) balances;

    function updateBalance(uint256 newBalance) public{

    balances[msg.sender] = newBalance; }

    function checkBalance(address _user) public view returns(uint256){

    require(msg.sender == _user, "You are not the owner of the account"); return balances[_user]; } } Can you please explain this solution it's not clearly mentioned?

    @sumanaweb3

    Sumana

    @sumanaweb3

    0

    This content was deleted by the author

    @chaitanya22

    Chaitanya Patil

    @chaitanya22

    0

    what if we want to create a array for mapping of struct so a class full of students can enroll themselves and have a roll number..

    @chaitanya22

    Chaitanya Patil

    @chaitanya22

    0

    previous mapping vedio and hands-on are not good as u already used require and msg.sender which is not taught yet. :(

    @nikhil62755443

    Nikhil Mukati

    @nikhil62755443

    0

    we can say this is alternate to create table in database

    @bizzext

    Naveen Sood

    @bizzext

Your comment