Skip to content

Update range-loop.odin - #1

Open
rmattson wants to merge 1 commit into
MrSheerluck:mainfrom
rmattson:patch-1
Open

Update range-loop.odin#1
rmattson wants to merge 1 commit into
MrSheerluck:mainfrom
rmattson:patch-1

Conversation

@rmattson

Copy link
Copy Markdown

Thanks for putting together the odinbyexample site -- I found it earlier today, and it's nice to see the start to this. Just a minor note here:

Odin's index value comes second, not first (as you would see in Go). See https://odin-lang.org/docs/overview/#range-based-for-loop for the examples there, under the "Alternatively a second index value can be added" section.

Odin's index value comes second, not first (as you would see in Go) (see https://odin-lang.org/docs/overview/#range-based-for-loop)
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec6e46be-72ea-482c-96aa-8cf3e63dc2c8

📥 Commits

Reviewing files that changed from the base of the PR and between 73243bb and 4671b32.

📒 Files selected for processing (1)
  • examples/range-loop/range-loop.odin

📝 Walkthrough

Summary by CodeRabbit

  • Examples
    • Updated the range-loop example to demonstrate the revised ordering of loop variables.
    • Adjusted the printed output to reflect the swapped value and index bindings.

Walkthrough

The range-loop example now binds its iteration components to value and index in the opposite order while keeping the loop body unchanged.

Changes

Range loop example

Layer / File(s) Summary
Swap range-loop bindings
examples/range-loop/range-loop.odin
The loop changes from index, value to value, index when iterating over numbers; the print statements remain unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: mrsheerluck

Poem

A bunny hops through numbers bright,
Swapping bindings left and right.
Value first and index near,
The loop prints on, crisp and clear.
Thump-thump—examples cheer!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the changed file and the range-loop ordering fix, though it is a bit generic.
Description check ✅ Passed The description accurately explains the index/value ordering fix and cites the relevant Odin docs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant