| For C users. And C++ users: In C++ we can declare variable in the while or if statement: https://en.cppreference.com/w/cpp/language/while https://en.cppreference.com/w/cpp/language/if It's value is the value of the decision. This is not possible with C [1]. Since C++17 the if condition can contain an initializer:
Ctrl+F if statements with initializer https://en.cppreference.com/w/cpp/language/if Which sounds like the same? Now you can declare a variable and it value is not directly evaluated, you also can compare it in a condition. I think both are neat features of C++, without adding complexity. [1] Also not possible with Java. |
Also in Java: https://www.geeksforgeeks.org/for-loop-java-important-points...