diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-31 01:15:25 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-31 01:15:25 +0000 |
| commit | 856c9fe56b412779e045ef86a767b93d5c7f563b (patch) | |
| tree | 6f851bb9bf300970c4a0d7186db0de86e510a18d /README.md | |
| parent | 03a6a57f500ee4230ce2cee887866b3850ed7ed9 (diff) | |
Improvements for slice + better iteration for arrays
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -494,8 +494,15 @@ for i in 0..<10 { ... } // Exclusive (Explicit) for i in 0..=10 { ... } // Inclusive (0 to 10) for i in 0..10 step 2 { ... } -// Iterator (Vec, Array, or custom Iterable) -for item in collection { ... } +// Iterator (Vec or custom Iterable) +for item in vec { ... } + +// Iterate over fixed-size arrays directly +let arr: int[5] = [1, 2, 3, 4, 5]; +for val in arr { + // val is int + println "{val}"; +} // While while x < 10 { ... } |
