0

What is the switch statement in kotlin?

Jun 16, 2020 in Kotlin by Anusha

1 answers to this question.

0

A standard switch statement is just a statement that substitutes a range of simple if/else that performs necessary checks but it cannot replace all kind of if/else series it can only replace those which compare a value with some constant.

A small example of a switch statement is given below:

switch(choice)

{

case 1:

system.out.println(“fruits”);

case 2:

system.out.println(“leaves”);

case3:

system.out.println(“branches”);

default:

system.out.println(“not a tree”);

}

Jun 16, 2020 answered by Sowjanya

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