1/* 2 * Copyright (c) 2023-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 16type array_tuple = [number, boolean]; 17 18function getIntAndString(): [number, string] { 19 let tup: [number, string] = [10, "c"]; 20 return tup; 21 } 22 23function main(): void { 24 let sample_tuple: [number, boolean, string, number] = [ 25 10, 26 true, 27 "B", 28 90, 29 ]; 30 31 let values: string = sample_tuple[0] + " " + sample_tuple[1] + " " + sample_tuple[2] + " " + sample_tuple[3]; 32 let array: array_tuple[] = [[1, true], [2, false], [3, false], [4, true],]; 33 array[1]; 34 array[2]; 35 array[3][1]; 36 37 let tuple: [number, string] = getIntAndString(); 38 39 40 41} 42