+ 1
Does C++ and Java actually have an else if statement or is it just an else statement with a nested if statement.
As it is possible to use statements that only require 1 statement without curly braces I thought that this: if (...) { ... } else if (...) { ... } else { ... } would actually be this: if (...) { ... } else { if (...) { ... } else { ... } } and no separate else if statements actually existed. Scanner sc = new Scanner(System.in); System.out.println("How is it?"); System.out.println(sc.nextBoolean());
1 Answer
+ 4
You're correct, there is no such thing like elif statement in both Java and C++, and yes, the else if is actually a nested if statement