1/* 2 * Copyright (c) 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 16class IfTest { 17 public Test(): void { 18 let t : boolean = true; 19 let a : int , b : int ; 20 if (t) a = 1; 21 if (t) a = 2; 22 else a = 3; 23 if (t) { 24 a = 4; 25 b = 100; 26 } 27 if (t) { 28 a = 5; 29 b = 101; 30 } 31 else { 32 a = 6; 33 b = 102; 34 } 35 if (t) a = 7; 36 else { 37 a = 8; 38 b = 103; 39 } 40 if (t) { 41 a = 9; 42 b = 104; 43 } 44 else a = 10; 45 let p : boolean = false; 46 if (t) if (p) a = 11; 47 else a = 12; 48 if (t) a = 13; 49 else if (p) { 50 a = 14; 51 } 52 if (t) a = 15; 53 else { 54 if (p) a = 16; 55 else a = 17; 56 } 57 if (t) { 58 if (p) { 59 a = 18; 60 b = 105; 61 } 62 else { 63 a = 19; 64 b = 106; 65 } 66 } 67 else if (p) a = 20; 68 else a = 21; 69 } 70} 71