-
Notifications
You must be signed in to change notification settings - Fork 7
Let
Giorgio Garofalo edited this page Oct 11, 2024
·
1 revision
The .let
function defines a temporary variable, accessible only within its scope. It accepts two parameters:
- The value, of any type, to assign to the scoped variable;
- A lambda block that accepts one parameter (the given value, indeed)
.let {.multiply {4} {2}}
area:
The area of the rectangle is .area.
If it were a triangle, it would have been .divide {.area} by:{2}.
The area of the rectangle is 8.
If it were a triangle, it would have been 4.
The function returns the evaluation of the lambda, thus it can be used as an expression:
.center
.let {Quarkdown}
name:
.uppercase {.name}, .lowercase {.name}, .capitalize {.name}
The lambda block accepts implicit positional parameters (see lambda)
.center
.let {Quarkdown}
.uppercase {.1}, .lowercase {.1}, .capitalize {.1}
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Localization
- Including other Quarkdown files
- Importing external libraries
- Document metadata
- Theme
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Table of contents
- Stacks (row, column, grid)
- Align
- Container
- Box
- Collapsible
- Whitespace
- String
- Number
- Markdown content
- Boolean
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic