Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
when (expression) { case value -> statements }
when (expression) { case value -> statements; default -> statements }
when (expression) { value -> statements }
when (expression) { value -> statements; default -> statements }
To check multiple conditions.
To execute a block of code if a condition is true.
To execute a block of code if a condition is false.
None of the above.
if (condition) { } else { }
if (condition) { } else
if { } else { }
if (condition) { }
if
else
switch
none of the above
if (variable != null) { } else { }
if (variable) { } else { }
if (variable == null) { } else { }
if (variable?.let { } ) { } else { }
To execute a block of code if the "if" condition is true.
To execute a block of code if the "if" condition is false.
if (condition) { } else if (condition) { } else { }
if (condition) { } else { } if (condition) { }
if (condition) { } if (condition) { } else { }
if { } else if { } else { }
To return a value based on a condition.
switch (expression) { case value: statements; default: statements; }
It is used to check multiple conditions.
It is similar to the switch statement in Java.
It can be used as a replacement for if-else and switch statements.
All of the above.