Optimize int loop jumps and document loop var immutability

This commit is contained in:
sergeych committed 2026-02-15 15:12:52 +03:00
1 parent db9dc73da8
commit 637258581d
13 files changed
+569 -110

No files matched your search

+2
View File
@@ -63,6 +63,8 @@ In spite of this you can use ranges in for loops:
>>> 3
>>> void
The loop variable is read-only inside the loop body (behaves like a `val`).
but
for( i in 1..<3 )
+1
View File
@@ -105,6 +105,7 @@ arguments list in almost arbitrary ways. For example:
var result = ""
for( a in args ) result += a
}
// loop variables are read-only inside the loop body
assertEquals(
"4231",
+1
View File
@@ -739,6 +739,7 @@ See also: [Testing and Assertions](Testing.md)
var result = []
for( x in iterable ) result += transform(x)
}
// loop variables are read-only inside the loop body
assert( [11, 21, 31] == mapValues( [1,2,3], { it*10+1 }))
>>> void