This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "contracts/範例程式_1/12_Array.sol": { | |
| "__sources__": { | |
| "contracts/範例程式_1/12_Array.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.28;\t\r\n\r\ncontract Array {\r\n \r\n int[] myArray1; \r\n \r\n constructor(){\r\n \r\n }\r\n \r\n function setValue( uint index, int value) public {\r\n require(index < myArray1.length, \"index error\");\r\n myArray1[index] = value;\t\r\n }\r\n \r\n function getValue( uint index ) public view returns( int value){\r\n require(index < myArray1.length, \"index error\");\r\n value = myArray1[index];\r\n }\r\n \r\n function getLength() public pure returns( uint256){\r\n return [uint256(3),4,5,6].length;\r\n //return myArray1.length;\r\n }\r\n \r\n function addValue( int value) public {\r\n myArray1.push(value);\r\n }\r\n\r\n function test1() public view returns( uint256[] memory a, uint256 len){\r\n a = new uint256[](7);\r\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "contracts/範例程式_1/12_Array.sol": { | |
| "__sources__": { | |
| "contracts/範例程式_1/12_Array.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.28;\t\r\n\r\ncontract Array {\r\n \r\n int[] myArray1; \r\n \r\n constructor(){\r\n \r\n }\r\n \r\n function setValue( uint index, int value) public {\r\n require(index < myArray1.length, \"index error\");\r\n myArray1[index] = value;\t\r\n }\r\n \r\n function getValue( uint index ) public view returns( int value){\r\n require(index < myArray1.length, \"index error\");\r\n value = myArray1[index];\r\n }\r\n \r\n function getLength() public pure returns( uint256){\r\n return [uint256(3),4,5,6].length;\r\n //return myArray1.length;\r\n }\r\n \r\n function addValue( int value) public {\r\n myArray1.push(value);\r\n }\r\n\r\n function test1() public view returns( uint256[] memory a, uint256 len){\r\n a = new uint256[](7);\r\n |