Skip to content

Rust Guide 14.5 "Looping" uses different syntax for different "match" branches #17672

Closed
@joshtriplett

Description

@joshtriplett

From the first example in 14.5:

        match cmp(num, secret_number) {
            Less    => println!("Too small!"),
            Greater => println!("Too big!"),
            Equal   => { println!("You win!"); },
        }

All three branches of the match should use the same syntax (with braces and semicolon, or without).

This likely occurs because the subsequent example adds a "return;" to the Equal case.

Metadata

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