Loops/Wrong ranges: Difference between revisions

imported>Thebeez
(Added uBasic/4tH version)
Line 1,958:
 
=={{header|langur}}==
In the following example, we could have just started with ana arraylist of arrayslists, but following the Python example, we process the .data string into a table.
Langur has series() and pseries() functions, which generate arrays. These are not limited to integers for start, stop, or increment values. The pseries() function never returns a descending series (returns empty array instead).
 
You don't always have to convert a range to a series explicitly. Since 0.6.15, the functions map(), fold(), foldfrom(), and zip() accept ranges in place of arrays.
 
In the following example, we could have just started with an array of arrays, but following the Python example, we process the .data string into a table.
 
{{trans|Python}}
{{works with|langur|0.10}}
Langur 0.7.0 changed the implicit exception variable from .err to _err, and 0.7.1 allows you to map to multiple functions.
 
Prior to 0.10, multi-variable declaration/assignment would use parentheses around the variable names (.start, .stop, .inc, .comment).
 
<syntaxhighlight lang="langur">val .data = q:block END
start stop increment comment
885

edits