Skip to content

Guide: section on for loops shows C code which can be mistaken for Rust code #17228

Closed
@bjpop

Description

Section 11.1 on for loops unusually begins by showing C syntax, saying "Rust's for loop doesn't look like this C for loop:"

In my opinion that is a strange way to introduce Rust's for loops.

Furthermore the C code is not clearly indicated to be in another language, so someone casually perusing the documentation may not notice that it is from another language.

Lastly, the C code has a link to the rust play pen, which obviously results in a syntax error if you try to run it:

:2:12: 2:13 error: expected ,, found =
:2 for (x = 0; x < 10; x++) {

I think it would be better to introduce Rust's notation first, and then perhaps make a passing remark that this is different to some languages (such as C) - though it is also similar to other languages, such as Python.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions