“Długość tablicy solidności” Kod odpowiedzi

Jak sprawdzić długość tablicy w solidności

// Solidity program to demonstrate 
// Push operation
pragma solidity ^0.5.0;  
   
// Creating a contract 
contract Types {  
  
    // Defining the array
    uint[] data = [10, 20, 30, 40, 50]; 
    
    // Defining the function to push 
    // values to the array
    function array_push(
    ) public returns(uint[] memory,uint256 length){  
    
        data.push(60);  
        data.push(70);  
        data.push(80);
    
        return (data,length);  
    }  
}
Homeless Herring

Jak sprawdzić długość tablicy w solidności

// Solidity program to demonstrate 
// Push operation
pragma solidity ^0.5.0;  
   
// Creating a contract 
contract Types {  
  
    // Defining the array
    uint[] data = [10, 20, 30, 40, 50]; 
    
    // Defining the function to push 
    // values to the array
    function array_push(
    ) public returns(uint[] memory){  
    
        data.push(60);  
        data.push(70);  
        data.push(80);
    
        return data;  
    }  
}
Homeless Herring

Długość tablicy solidności

uint8[3] fixedList;
// fixedList.length => 3

uint8[] dynamicList;
uint8.push(1)
uint8.push(2)
// dynamicList.length => 2
John Appleseed

Odpowiedzi podobne do “Długość tablicy solidności”

Pytania podobne do “Długość tablicy solidności”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu