Loops/Wrong ranges: Difference between revisions

Content added Content deleted
m (Fix Perl 6 -> Raku in comments)
Line 801: Line 801:


{{trans|Python}}
{{trans|Python}}
{{works with|langur|0.7.1}}
{{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.
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).

<lang langur>val .data = q:block END
<lang langur>val .data = q:block END
start stop increment comment
start stop increment comment
Line 819: Line 822:
val .f = toNumber
val .f = toNumber
for .i in 2..len(.table) {
for .i in 2..len(.table) {
.table[.i] = map([.f, .f, .f, _], .table[.i])
.table[.i] = map [.f, .f, .f, _], .table[.i]
}
}


for .test in rest(.table) {
for .test in rest(.table) {
var (.start, .stop, .inc, .comment) = .test
val .start, .stop, .inc, .comment = .test
{
{
val .series = series(.start to .stop, .inc)
val .series = series(.start to .stop, .inc)