Computer Science, asked by TbiaSamishta, 1 year ago

The else keyword always matches to the nearest if statement? State whether the statement is True (or) False And Justify it

Answers

Answered by Secondman
1

"Yes. The given statement is true.

The else keyword always matches to the nearest if statement.

If there are two if statements and after that, there is only one else statement, then the else statement will match up with the nearest if statement, which is the second one.

In nested if else statements, if there's only one else statement, then this may lead to an ambiguity which is known as dangling else problem."

Similar questions