The sub return will return values, not containers. Select your protection plan and purchase it with this product by clicking Add to Cart above. Please check the functions documentation for more information on how return values are handled and produced. In almost any case last is the better alternative. inside map) may find the outer lexical routine gone by the time the block is executed. A return in a block that is evaluated lazily (e.g. GSA 300 - Order for Supplies and Services - Revised. GSA 527 - Contractors Qualifications and Financial Information - Revised.
GSA 308 - Notice of Inspection - Renewed. GSA 1678 - Status Report of Orders and Shipments - Renewed. Please note that a return in the root of a package will fail at runtime. FORMS LIBRARY ASSISTANCE: LATEST UPDATES. If it passes a control exception is raised and can be caught with CONTROL.Īny return in a block is tied to the first Routine in the outer lexical scope of that block, no matter how deeply nested. If the type check fails the exception X::TypeCheck::Return is thrown. If a return type constraint is provided it will be checked unless the return value is Nil. The sub return will stop execution of a subroutine or method, run all relevant phasers and provide the given return value to the caller. The following examples should illustrate the if or when block's default behavior assuming no special exit or other side effect statements are included in the if or when blocks:Īll these forms may produce a return value the same way loop does.
#PHASER 3.0 DOCS CODE#
But there is a difference in how following code in the same, outer block is handled: When the when block is executed, control is passed to the enclosing block and following statements are ignored but when the if block is executed, following statements are executed. The when block is similar to an if block and either or both can be used in an outer block they also both have a "statement modifier" form. Even within the else clause, if you try to use the value directly, it will result in your else clause itself failing (or, in Rakudo, "promoting" the Failure into a thrown exception).īut as seen above, you can use the methods of a handled Failure object the else topicalizes, such as exception, if you wish to provide diagnostics or interrogate the underlying Exception.
Note that while topicalizing a Failure marks it handled-so you can use the with/ else to proceed safely with execution-it doesn't make the Failure value itself safe.