Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

02 - Basic Calculator - If/Else nonsensical example #289

Open
@TellyO3

Description

@TellyO3

The code below will never print 3, and should not be an if/else. I think it's confusing to new learners to include code that does not do what it suggests. This code prints "number is smaller than 5" for everything < 5 and for anything >=5 it prints "number greater than or equal to 3, but smaller than 5" for any other value.

let number =3;if number <5{println!("`number` is smaller than 5");}elseif number >=3{println!("`number` is greater than or equal to 3, but smaller than 5");}else{println!("`number` is smaller than 3");}

This should be changed to an example that actually requires the use of if else and does what it is supposed to do.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp