CryptoZombies | Structs

728x90

Structs

  • 복잡한 데이터를 하나의 타입으로 묶어 저장할 수 있는 데이터 타입
struct Person {
  uint age;
  string name;
}

 

  • string: UTF-8 문자열 데이터를 저장하는 데 사용되는 자료형 (임의의 길이의 문자 데이터를 저장)

CryptoZombies 실습

pragma solidity ^0.4.19;

contract ZombieFactory {

    uint dnaDigits = 16;
    uint dnaModulus = 10 ** dnaDigits;

    struct Zombie {
        string name;
        uint dna;
    }

}
728x90

'공부 > Solidity' 카테고리의 다른 글

CryptoZombies | Function Declarations  (0) 2024.11.17
CryptoZombies | Arrays  (0) 2024.11.17
CryptoZombies | Math Operations  (0) 2024.11.17
CryptoZombies | State Variables & Integers  (0) 2024.11.17
CryptoZombies | contract  (0) 2024.11.17