This article is a review of CryptoZombies Lesson2. From beginner Lesson2, some solidity specific description methods come out, so program beginners may feel a little difficult here.
この記事はCryptoZombiesレッスン2のレビューになります。レッスン2からはsolidity特有の記述方法がいくつか出てくるためプログラム初心者の方はここから少し難しく感じるかもしれません。
What you will learn in Lesson 2
・mapping and address
・require
・contractor Inheritance
・import
・sotrage and memory
・interface
・Handling Multiple Return Values
レッスン2で学習する内容は
・マッピングとアドレス
・require
・コントラクタの継承
・import
・ストレージとメモリ
・interface
・複数の返り値処理
という内容になります。
Maping is a simple explanation of array. The difference is that you can express subscripts of any type. i certainly feel that there was a similar way of expression in Swift. The address is the address of the wallet.
require is the process of throwing an error. In the lesson, we set conditions and describe not to execute the subsequent processing by throwing an error if the condition is not satisfied.
This is the same as inheritance of other languages.
It's like C language include statement.
If you write storage before the variable, that variable will be permanently saved on the block chain. memory is temporary storage.
It is used to use the contractor function of another project.
In solidity, you can specify multiple return values.
マッピングとは簡単に説明すると配列の事です。違いは添字を任意の型で表現できるところですね。確かSwiftでも同じような表現方法があった気がします。アドレスはwalletのアドレスの事です。
requireはエラーを投げられる処理になります。レッスン内では条件を設定して、条件を満たさない場合にエラーを投げて以降の処理を実行しないよう記述しています。
こちらは他言語の継承と変わりません。
c言語でいインクルード文のようなものです。他ファイルのコントラクタを使用する時に必要になります。
storage と変数前に記述するとその変数はブロックチェーン上に永久に保存されます。Memory は一時的な保存です。
別プロジェクトのコントラクタ関数を利用する際に使用します。
solidityでは戻り値を複数指定する事ができます。
In Lesson 2 we invoked Crypto Kitty's contractor function using interface to prey on crypto kitty and make it zombie. I felt that it is an advantage that Dapps is open source as it can use data from another project.
レッスン2ではInterfaceを使用してクリプトキティのコントラクタ関数を呼び出し、クリプトキティを捕食してゾンビにしました。別プロジェクトのデータを利用できるのはDappsがオープンソースだからこその利点だと感じました。