Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.07 KB

Modifiers.md

File metadata and controls

29 lines (22 loc) · 1.07 KB

They can be used to change the behaviour of functions in a declarative way.

For example, you can use a modifier to automatically check a condition prior to executing the function.

The function’s control flow continues after the _ in the preceding modifier.

Multiple modifiers are applied to a function by specifying them in a whitespace-separated list and are evaluated in the order presented.

The modifier can choose not to execute the function body at all and in that case the return variables are set to their default values just as if the function had an empty body.

The _ symbol can appear in the modifier multiple times. Each occurrence is replaced with the function body.


Slide Screenshot

022.jpg


Slide Deck

  • Function Modifiers
  • modifier Keyword
  • modifier mod() {checks; _;
  • function foo() mod {}
  • mod -> foo()
  • Pre-conditions: Access Control
  • Post-conditions: Accounting

References