Menu

keywords-instructions

Will Pittenger

This keyword allows complex statements to have a callback. The whole idea behind a complex statement is to have a custom loop or if statement. This means your complex statement needs a way to run the code requested. The instructions keyword provides that means. When you call instructions, you can pass any identifier you want the passed code to have access to. For example, a foreach style loop might pass the iterator. See the [Complex statements] section and the statement keyword for more information. See Declaration sequence for more on declaration sequences. Variables listed in a instructions statement are implicitly const readonly to the calling code.

Delegates, interfaces, and abstract complex statements have a different use for the instructions keyword. There, it lists the types to be passed (all are implicitly const readonly). See the sections [Complex statements], [Delegates], [Interfaces], and [Members and methods] for more information.

In concrete code

\statement\ /identifier/ [(/DeclarationSequence/)...sequences]
  ' Run some code
  \instructions\ [/OptionalItemsToMakeAvailable/]
  ' Run some more code

For more on what /DeclarationSequence/ can be, see Declaration sequences. /OptionalItemsToMakeAvailable/, if present, must be a comma delimited list of identifiers to make visible as const readonly variables to the calling code.

In abstract complex statements, interfaces, and delegates

\statement\ /identifier/ [(/DeclarationSequence/)...sequences]
  \instructions\ [/OptionalTypeList/]

/OptionalTypeList/, if present, must be a comma delimited list of Type descriptors.


Related

Wiki: Appendices-Terms-Declaration sequence
Wiki: Complex Statements
Wiki: Delegates
Wiki: Interfaces
Wiki: Keywords
Wiki: Members and methods
Wiki: Scope rules
Wiki: keywords-const
Wiki: keywords-override
Wiki: keywords-statement
Wiki: keywords-static