I recently read about labelled statments in java and the ability to specify a label with the break and continue statements. What other languages support this sort of syntax ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a list of languages with Java-like labels; i.e the ability to branch out of a labeled statement or block.
goto <label>, but notbreak <label>orcontinue <label>.exit <label>statement.exit <label>orcontinue <label>statements.Here’s a list of languages with a more general GO TO construct (or equivalent), allowing an application to branch to any label at the same syntactic level or outer level.
Many languages (also) support throwing and catching exceptions. This can be thought of as a generalized form of branch-to-label. However there are two important distinctions:
(Ruby’s
throw / catchseems to have aspects of normal exception handling and labeled statements. However, I’m inclined to think that since the label does not need to be lexically scoped, this is closest to normal exception handling.)please add more.