pragma solidity ^0.4.18; // Creating a contract contract Types { // Declaring a dynamic array uint[] data; // Declaring state variable uint8 j = 0; // Function to demonstrate 'Do-While loop' function loop() public returns (uint[] memory) { do { j++; data.push(j); } while (j < 5); return data; } // Function to get the data array function getData() public view returns (uint[] memory) { return data; } }
0.4.18