Code to perform if else operation in Kotlin?


Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
All QuestionsCategory: KotlinCode to perform if else operation in Kotlin?
chetan shidling asked 5 years ago

I need short information.

1 Answers
chetan shidling answered 5 years ago

Here is the code to perform the if-else operation in Kotlin.
 
fun main(args:Array <String>){
var num1: Int = 3
var num2: Int = 9
var result: Int = 0
if(num1 > num2)
result = num1
else
result = num2
println(“The biggest number is $result”)
}
 
Output:
 
The biggest number is 9