If
the condition true, then if block code will execute, otherwise else block code
will execute.
Syntax:
if(condition){
}else{
}
IfElse.kt
fun main(args: Array<String>) { var marks: Int = 65 if (marks < 35) { println("You failed in the Exam. Better luck next time"); } else { println("You passed in the exam") } }
Output
You passed in the exam
No comments:
Post a Comment