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