【試讀版】All In One Solidity
KrypltoCampChiHaoLu
  • Welcome!
  • | Chapter 0 | Intro
    • 【推薦序】
    • 【前言】
  • Part I Basic
    • | Chapter 1 | 基本介紹 Introduction
      • 【環境建置 Remix IDE】
      • 【版本控制】
      • 【Hello World & First Contract】
      • 【Practice】
      • 【Answer】
    • | Chapter 2 | 型別 Types & 變數 Variables
      • 【Integer】
      • 【Bool】
      • 【Address】
      • 【Contract & This】
      • 【String】
      • 【Scope】
      • 【Practice】
      • 【Answer】
    • | Chapter 3 | 單位 Unit & 運算子 Operators
      • 【單位】
      • 【Time】
      • 【運算子】
      • 【Practice】
      • 【Answer】
    • | Chapter 4 | 流程控制 Selection and Repetition
      • 【If-Else】
      • 【For】
      • 【While】
      • 【Practice】
      • 【Answer】
    • | Chapter 5 | 函式 Function
      • 【Returns】
      • 【Visibility】
      • 【stateMutability】
      • 【Constructor】
      • 【Function Overloading】
      • 【Fallback】
      • 【Useful Function】
      • 【Practice】
      • 【Answer】
    • | Chapter 6 | 資料結構 Data Structures
      • 【Array】
      • 【Mapping】
      • 【Structs】
      • 【Enum】
      • 【Practice】
      • 【Answer】
    • | Chapter 7 | 角色和全局訊息 Global Variables
      • 【Msg】
      • 【Block】
      • 【ABI】
      • 【TX】
      • 【Practice】
      • 【Answer】
  • Part II Medium
    • | Chapter 8 | 記憶體配置 Memory Allocation
    • | Chapter 9 | 異常處理 Handling Exception
      • 【Require】
      • 【Assert】
      • 【Revert】
      • 【Try/Catch】
      • 【Practice】
      • 【Answer】
    • | Chapter 10 | 事件 Event
      • 【emit】
      • 【Indexed】
      • 【web3.eth.subscribe()】
      • 【Logs with Data & Topics】
      • 【anonymous】
      • 【Practice】
      • 【Answer】
    • | Chapter 11 | 繼承 Inheritance
      • 【Inheritance】
      • 【Modifier】
      • 【合約互動】
      • 【Function Overriding】
      • 【Polymorphism】
      • 【多重繼承與 super】
      • 【Practice】
      • 【Answer】
    • | Chapter 12 | 介面 Interface
    • | Chapter 13 | 引用 Imports & 函式庫 Libraries
      • 【Library】
      • 【Import】
      • 【OpenZeppelin】
      • 【Practice】
      • 【Answer】
    • | Chapter 14 | ERC & Token
  • PART III Advanced
    • | Chapter 15 | 佈署 Deploy & 編譯 Compiler
    • | Chapter 16 | 開發工具 Dev. Tools
    • | Chapter 17 | 最佳化合約 Contract Optimization
  • | OTHERS | Information & Reference
    • 【結語】
    • 【參考資料】
Powered by GitBook
On this page

Was this helpful?

  1. Part I Basic
  2. | Chapter 6 | 資料結構 Data Structures

【Practice】

  • Practice 1

    • 利用迴圈找出陣列 [34, 231, 4534, 231, 23, 45, 80, 67798, 67783] 的最小值與最大值

  • Practice 2

    • 利用迴圈找出 [34, 231, 4534, 231, 23, 45, 80, 67798, 67783] 有幾個奇數

  • Practice 3

    • 利用迴圈找出 [2, 256, 4534, 1024, 23, 45, 0, 2048, 67783, 8, 64] 有幾個為 2 的正整數次方

  • Practice 4

    • 利用 mapping 建立一個名為 whitelist 的容器,並儲存三筆address映射bool資料

  • Practice 5

    • 阿豪想要架設一個交易多餘電力的合約,在合約中宣告一個struct表示當前加入此電力系統的會員們,並在內宣告一個mapping需要由address映射uint,代表他們當前擁有可販賣的多餘電力。

  • Practice 6

    • 承上,宣告一個enum分別代表三種會員電力系統的狀態:malfunction, insufficient, surplus

  • Practice 7

    • 承上,在我們Practice 5的struct中再宣告一個mapping由address映射uint,用於儲存每位會員的電力系統狀態。

Previous【Enum】Next【Answer】

Last updated 3 years ago

Was this helpful?