# Hillel Wayne - Procedures and Macros :: Learn TLA+ (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png) ## Metadata **Cover**:: https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png **Source**:: #from/readwise **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Hillel Wayne]] **Full Title**:: Procedures and Macros :: Learn TLA+ **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [learntla.com](https://learntla.com/concurrency/procedures-and-macros/) **Host**:: [[learntla.com]] **Highlighted**:: [[2020-09-20]] **Created**:: [[2022-09-26]] ## Highlights - Macros are the general catch-all code inliner. - they can’t have labels, multiple assignments, while loops, etc. - Macros must be defined after any `define` block and before any processes. - This cannot be \in, only = - The return just ends the procedure. - a procedure can have internal variables. Two, you can have labels in them. - you have to explicitly use `call Name(val1, ...);`, and the following line must be a label or a `return` - If you want to use procedures you *must* `EXTEND Sequences`. - Procedures must be defined after any macros and before any processes. - Macros are faster and less complicated. If you can use them, use them. Use procedures when you have multiple separate processes that can do the same actions. - The `define` block has to come before any macros, which has to come before any procedures, which has to come before any processes.