J3/04-109 Date: 08 Dec. 2003 To: J3 From: Dan Nagle Subject: Exit from Any Block Allowing an EXIT statement to exit from any block removes one remaining use of goto's; with block names, it is a clear way to prematurely end block processing. Number: Title: EXIT from Any Block Submitted By: J3 Status: For Consideration References: Basic Functionality: Allow an EXIT statement in any block construct. Rationale: A program may detect a reason for immediately exiting a block. At present, this may be done (without recourse to the low-level goto) only from DO blocks. Extending EXIT to IF, SELECT CASE, ASSOCIATE, SELECT TYPE blocks would regularize the language at a high level. Estimated Impact: The estimated impact is low, as EXIT is a synonym for goto, which is already supported. The target statement is the END statement, which is easily found. Detailed Specification: Allow EXIT in IF, SELECT CASE, ASSOCIATE & SELECT TYPE blocks, where it functions as a goto to the end block statement. Example: end_case: if( detect_end_case() )then call fixup_part1() if( .not. severe() ) exit end_case call fixup_part2() endif end_case History: