0

Who to iterate the elements through an array by using for loop in kotlin?

Jun 16, 2020 in Kotlin by Sri

1 answers to this question.

0

There is no inherited for loop within Kotlin unlike Java and additional languages. Within Kotlin, for loop is utilized to iterate over arrays, ranges, maps, etc., anything that gives an iterator.

Take a look at a simple example to understand the iteration process of elements through an array by utilizing the for loop in kotlin.

Ex:

Fun main(args : Array)

{

Val percentage = arrayOf(50, 65, 70, 80, 85)

for(item in percentage)

{

println(item)

}

}

 

Jun 16, 2020 answered by Surya

Related Questions

0 1 answers

Kotlin Lambda Example

Explain about kotlin lambda expression with example?

Jun 16, 2020 in Kotlin by Irshad
0 1 answers

Kotlin Abstract Class

What is the abstract class in kotlin?

Jun 16, 2020 in Kotlin by Irshad
0 1 answers

Kotlin Default Arguments

How the default argument in kotlin works?

Jun 16, 2020 in Kotlin by Irshad