Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
if (variable != null) { } else { }
if (variable) { } else { }
if (variable == null) { } else { }
if (variable?.let { } ) { } else { }
if (condition) { } else { }
when (expression) { case value -> statements }
switch (expression) { case value: statements; default: statements; }
None of the above.
unless (condition) { }
unless { } else { }
unless (condition) { } else { }
when (expression) { case value -> statements; default -> statements }
when (expression) { value -> statements }
when (expression) { value -> statements; default -> statements }
It is used to check if a variable is null.
It can be used as a replacement for the if-else statement.
It can be nested within other conditional statements.
All of the above.
To check multiple conditions.
To return a value based on a condition.
To execute a block of code if a condition is true.
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.
To execute a block of code if a condition is false.
To check for a specific condition.
To execute a block of code if none of the cases match.
To execute a block of code if the switch expression is null.