mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Fixed Looping Helpers docs formatting.
This commit is contained in:
parent
0cd34406a3
commit
8b922f7a15
2 changed files with 5 additions and 2 deletions
|
@ -460,18 +460,20 @@ module shape_compare(eps=1/1024) {
|
|||
|
||||
// Section: Looping Helpers
|
||||
// You can use a list comprehension with a C-style for loop to iteratively make a calculation.
|
||||
// .
|
||||
// The syntax is: `[for (INIT; CONDITION; NEXT) RETVAL]` where:
|
||||
// - INIT is zero or more `let()` style assignments that are evaluated exactly one time, before the first loop.
|
||||
// - CONDITION is an expression evaluated at the start of each loop. If true, continues with the loop.
|
||||
// - RETVAL is an expression that returns a list item for each loop.
|
||||
// - NEXT is one or more `let()` style assignments that is evaluated at the end of each loop.
|
||||
// .
|
||||
// Since the INIT phase is only run once, and the CONDITION and RETVAL expressions cannot update
|
||||
// variables, that means that only the NEXT phase can be used for iterative calculations.
|
||||
// Unfortunately, the NEXT phase runs *after* the RETVAL expression, which means that you need
|
||||
// to run the loop one extra time to return the final value. This tends to make the loop code
|
||||
// look rather ugly. The `looping()`, `loop_next()` and `loop_done()` functions
|
||||
// can make this somewhat more legible.
|
||||
// Example(NORENDER):
|
||||
// ```openscad
|
||||
// function flat_sum(l) = [
|
||||
// for (
|
||||
// i = 0,
|
||||
|
@ -488,6 +490,7 @@ module shape_compare(eps=1/1024) {
|
|||
// i = i + 1
|
||||
// ) if (loop_done(state)) total;
|
||||
// ].x;
|
||||
// ```
|
||||
|
||||
|
||||
// Function: looping()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,441];
|
||||
BOSL_VERSION = [2,0,442];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue