-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain multi-object for loops and range syntax #262
Conversation
@Arya-Elfren Thanks. Did you see this: #261 |
No, I didn't. I just saw that exercise and thought it was probably an artifact of when we still had magical index captures and didn't explain the new concepts yet. I definitely think we could use an extra exercise for multi-for loops but I don't know if it should be separated from the other ones like that? Anyway, what should I do about this commit? Just leave it and wait for more feedback? |
@Arya-Elfren Hmmm... yeah, let's just leave this open until I get a chance to post ex 100. There might be some overlap. |
How easy is it to re-order exercises? (I haven't looked at If we were doing exactly one concept per exercise I would do three (maybe four for overkill?) for loop exercises in a row:
|
Re-ordering is certainly possible, but would be...painful, especially since "Ex. XXX" references in GitHub issues would all suddenly be wrong. You're right that the order is weird. If Ziglings were a book, it would be a total mess. But I think it's forgivable and maybe even kind of fun (to be charitable) to introduce concepts as Zig introduces them... |
@Arya-Elfren Okay, between these five Exercises, how do you feel about the coverage of https://github.com/ratfactor/ziglings/blob/main/exercises/015_for.zig (Note that I've added some new comments to Ex 15 and 16 explaining that a proper explanation comes later.) |
I feel like that's very comprehensive, I especially like ex95. Other than the fact that they have to be separate (which is understandable) I think that's really good coverage. |
Great, thanks for the feedback! |
I think it makes more sense to actually explain what the range syntax means (other than just as an index generator) and that for loops can iterate over multiple things. Something to build an intuition so that people could come up with this code on their own if they needed to because they understand what a range is:
I've tried explaining it but I don't know if it works well, especially within the wider context of ziglings.
I don't know if it's better (or necessary) to explain mult-object for loops in a separate exercise and then introduce ranges in a different on (make exercise 17 about ranges in for loops and 16 just about multi-object)?