Java: break and continue with an optional boolean condition

George Radev georgeradev at gmail.com
Mon Jun 11 12:54:26 UTC 2018


Dear amber-dev team,

Would you consider a proposal for extending break and continue with an
optional boolean condition as reasonable?
The idea can be summarized in the code example:

    for (;;) {
        ...

        break (i > 10);
        ...

        continue (i <= 12);

        ...

    }
//syntax will be:  break/continue [label] [boolean expression];

This will increase the code readability of for, do and while; and leave
additional if and some curly brackets out of the picture.

My arguments for such extension is that it solves the expressiveness
concerns that Donald E. Knut explain in its article "Structured Programing
with GOTO statements" by describing the Ole-Johan Dahl proposal for [loop
while repeat] structure where the condition is not bound to the beginning (
do...while()) nor to the end of the repeating block (while()...) which
makes the controlled flow of the program more effective.

Thank you for your time and consideration!

With Regards,
George Radev


More information about the amber-dev mailing list