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 { }
To check multiple conditions.
To return a value based on a condition.
To execute a block of code if a condition is true.
None of the above.
if
else
switch
none of the above
if (condition) { } else { }
when (expression) { case value -> statements }
switch (expression) { case value: statements; default: statements; }
if (condition) { } else if (condition) { } else { }
It is used to check multiple conditions.
It can be used as a replacement for the switch statement.
It can be nested within other conditional statements.
All of the above.
To execute a block of code if the "if" condition is true.
To execute a block of code if the "if" condition is false.
unless (condition) { }
unless { } else { }
unless (condition) { } else { }
when (expression) { case value -> statements; default -> statements }
when (expression) { value -> statements }
when (expression) { value -> statements; default -> statements }