![]() Then, we just wanted to print the elements of this range on the terminal. We have assigned a range, i.e., 1 to 10, to this “for” loop to iterate over. In this basic script, we have simply defined a “main()” function within which we have a “for” loop. We have used the script shown below for this purpose: Now, we will create a Kotlin script for printing the elements of a given range in ascending order. The output of our first Kotlin script is shown in the following image:Įxample # 2: Printing the Elements of a Range in the Ascending Order utilizing the For Loop in Kotlin:
0 Comments
Leave a Reply. |