Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Mappings

Bài 14: Tài liệu tự học Solidity. Mappings và Addresses trong ngôn ngữ lập trình Solidity

Mappings & Addresses Trong ngôn ngữ lập trình Solidity.  Trong khoá học online miễn phí Tự học lập trình web3 - Tự học ngôn ngữ lập trình Solidity Summary for English Visiter mapping (address => uint) favoriteNumber; function setMyNumber(uint _myNumber) public { // Update our `favoriteNumber` mapping to store `_myNumber` under `msg.sender` favoriteNumber[msg.sender] = _myNumber; // ^ The syntax for storing data in a mapping is just like with arrays } function whatIsMyNumber() public view returns (uint) { // Retrieve the value stored in the sender's address // Will be `0` if the sender hasn't called `setMyNumber` yet return favoriteNumber[msg.sender]; } Thank you! Addresses - Địa chỉ ví Blockchain Ethereum có các tài khoản, bạn có thể coi nó giống như tài khoản ngân hàng. Một tài khoản có số dư Ether (đơn vị tiền tệ được sử dụng trên chuỗi khối Ethereum) và bạn có thể gửi và nhận các khoản thanh toán bằng Ether đến các tài khoản khác, giống như tài khoản