Skip to content

remove semicolon for suppressed the expressions to unit #19699

Closed
@He-Pin

Description

@He-Pin

Hi I am new to rust,and when I am reading examples from rust by example,I found this one is really confusing.

This may not always be desired, so the output can be suppressed by ending the expression with a semicolon ;

why not just make the return type as unit,then the return type of the expression just been ignored just like scala.

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