0% found this document useful (0 votes)
8 views2 pages

Solitity Programming

Uploaded by

Neha.Kale K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Solitity Programming

Uploaded by

Neha.Kale K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

// Solidity program to demonstrate

// how to find length of an array


pragma solidity ^0.5.0;

// Creating a contract
contract Types {

// Declaring an array
uint[6] data;

// Defining a function to
// assign values to an array
function array_example(
) public payable returns (uint[6] memory){
data = [uint(10), 20, 30, 40, 50, 60];
return data;
}

// Defining a function to
// find the length of the array
function array_length(
) public returns(uint) {
uint x = data.length;
return x;
}
}

// 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;
}
}
Output :

// 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;
}
}

Output :

You might also like