Skip to content

Literals and operators - Wording - need to tell the compiler the type #1874

Open
@manoharreddyporeddy

Description

Please review below for any doc changes needed

At https://doc.rust-lang.org/rust-by-example/primitives/literals.html
It says We need to tell the compiler the type of the literals we use.
I felt that is must or have to ( though it dint say so ), otherwise may tell or could tell can be used

However, it works without telling the type
There is no need to tell, it can infer.
So doc should be changed?

==

// Integer addition
println!("1 + 2 = {}", 1 + 2);       // =============== i wrote this
println!("1 + 2 = {}", 1u32 + 2);

1 + 2 = 3 // =============== i wrote this
1 + 2 = 3

==

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions