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 16"use strict"; 17 18function foo1() { 19 let ans = 0; 20 for(let i=0;i<10;i=i+1) 21 { 22 ans = ans + 1; 23 } 24 print(ans) 25} 26function foo2() { 27 let ans = 0; 28 for(let i=0;i<=10;i=i+1) 29 { 30 ans = ans - 1; 31 } 32 print(ans) 33} 34function foo3() { 35 let ans = 0; 36 for(let i=10;i>=0;i=i-2) 37 { 38 ans = ans + 1; 39 } 40 print(ans) 41} 42function foo4() { 43 let ans = 0; 44 for(let i=10;i>0;i=i-2) 45 { 46 ans = ans + 1; 47 } 48 print(ans) 49} 50function foo5() { 51 let ans = 0; 52 for(let i=10;i>0;i=i-2) 53 { 54 ans = ans + 1.1; 55 } 56 print(ans) 57} 58foo1(); 59foo2(); 60foo3(); 61foo4(); 62foo5(); 63