Kotlin Conditions | If-Else Statements in Kotlin

package com.example.my_kotlin_practice

fun main(args: Array<String>){
val a:Int = 35
val b:Int = 40

if(a>b) {
println("$a is greater than $b")
}
else
{
println("$b is greater than $a")
}

println(if(a>b) a else b)

val marks:Int = 100
val grade = if(marks>60) "Excellent" else if(marks<60 && marks>45) "Good" else "Poor"
println("Your grade is : $grade")

}

OUTPUT :

40 is greater than 35

40

Your grade is : Excellent


Process finished with exit code 0 

Comments

Popular posts from this blog

Maps (Collections) in kotlin

Functions in Kotlin

Arrays in Kotlin