• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2025 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  assertEQ(DATA[0][0], 0.1)
25  assertEQ(DATA[0][1], 1.2)
26  assertEQ(DATA[1][0], 2.3)
27  assertEQ(DATA[1][1], 3.4)
28  assertEQ(DATA[2][0], 4.5)
29  assertEQ(DATA[2][1], 5.6)
30  assertEQ(DATA[3][0], 6.7)
31  assertEQ(DATA[3][1], 7.8)
32  DATA[1][1] = 8.9;
33  assertEQ(DATA[1][1], 8.9)
34
35  let b: String[][] = new String[2][2];
36
37  b[0][0] = "hello";
38  assertEQ(b[0][0], "hello")
39
40  let strArray: String[][] = [
41    ["ab", "ac"],
42    ["bb", "bc"]
43  ];
44
45  assertEQ(strArray[0][0], "ab")
46  assertEQ(strArray[0][1], "ac")
47  assertEQ(strArray[1][0], "bb")
48  assertEQ(strArray[1][1], "bc")
49}
50