# Slice range notation format

**URL:** <https://ziggit.dev/t/slice-range-notation-format/15299>\
**Category:** Brainstorming\
**Created:** [May 3, 2026, 2:11pm UTC](https://ziggit.dev/t/slice-range-notation-format/15299 "2026-05-03T14:11:24Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [October 28, 2026, 10:41am UTC](https://ziggit.dev/t/slice-range-notation-format/15299/21 "2026-10-28T10:41:47Z")

</div>

Personally I would really like a reverse for, it’s kinda awkward to do the same thing with a while.

```zig
// 4 3 2 1 0
reverse for (0..5) |i| {
    std.debug.print("{} ", .{i});
}

```

---

<div class="post-metadata">

**Author:** ![makro](https://ziggit.dev/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@makro](https://ziggit.dev/u/makro)\
**Post date:** [October 28, 2026, 11:12am UTC](https://ziggit.dev/t/slice-range-notation-format/15299/22 "2026-10-28T11:12:42Z")

</div>

I doubt 0..array.len syntax will be changed, as most used and most convenient.

However, if we really want to cover those rare cases, clearly making them different from normal array-safe-ranges to avoid mistakes, and without overflow issue, maybe add something to be used inside for syntax:  
@inclusiveRange(0, 5) // 0,1,2,3,4,5  
@exclusiveRange(0, 5) // 1,2,3,4  
_or: ..Range(0..5) / …Range(arr) syntax too_

Maybe one could create functions, except not sure how to handle (+1 ) overflow properly then, and use with for(exclusiveRange(0, 5)). If done with buildins, I assume overflow is just optimized out inside for code generated, so \>= vs. \> or so in asm/IR/something, no op to prevent it.

[Previous page](https://ziggit.dev/t/slice-range-notation-format/15299.md?page=1)
