1/* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16function main(): void { 17 const DATA : double[][] = [ 18 [0.1, 1.2], 19 [2.3, 3.4], 20 [4.5, 5.6], 21 [6.7, 7.8] 22 ]; 23 24 assert(DATA[0][0] == 0.1); 25 assert(DATA[0][1] == 1.2); 26 assert(DATA[1][0] == 2.3); 27 assert(DATA[1][1] == 3.4); 28 assert(DATA[2][0] == 4.5); 29 assert(DATA[2][1] == 5.6); 30 assert(DATA[3][0] == 6.7); 31 assert(DATA[3][1] == 7.8); 32 DATA[1][1] = 8.9; 33 assert(DATA[1][1] == 8.9); 34 35 let b: String[][] = new String[2][2]; 36 37 b[0][0] = "hello"; 38 assert(b[0][0] == "hello"); 39 40 let strArray: String[][] = [ 41 ["ab", "ac"], 42 ["bb", "bc"] 43 ]; 44 45 assert(strArray[0][0] == "ab"); 46 assert(strArray[0][1] == "ac"); 47 assert(strArray[1][0] == "bb"); 48 assert(strArray[1][1] == "bc"); 49} 50